how to write send email test case and read excel file test case in selenium : #Here is my my code to write a sample send email test case#
when running  the code email is not getting triggered. Please find attached data for more details 

 1. [Login User details][1]
 2. [Invalid User Details][2]
 3. [Booking Data][3]


----------
Can anyone please help to resolve the issue as I am novice in selenium automation testing.
Below is sample code of my java code for configuration and triggering of email.


1
down vote
favorite
How to send out an Email notification in selenium webdriver using java, whenever some scenario is failed/passed in between ??  


----------


  [1]: https://i.stack.imgur.com/Dxvbf.jpg
  [2]: https://i.stack.imgur.com/X387W.jpg
  [3]: https://i.stack.imgur.com/FVlfg.jpg


    public class SendEmail {
    public SendEmail() {
    	}
    
    	public void email() {
    
    		// Create object of Property file
    		Properties props = new Properties();
    
    		// this will set host of server- you can change based on your
    		// requirement
    		props.put("mail.smtp.host", "smtp.gmail.com");
    
    		// set the port of socket factory
    		props.put("mail.smtp.socketFactory.port", "465");
    
    		// set socket factory
    		props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    
    		// set the authentication to true
    		props.put("mail.smtp.auth", "true");
    
    		// set the port of SMTP server
    		props.put("mail.smtp.port", "465");
    
    		// This will handle the complete authentication
    		Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() {
    			protected PasswordAuthentication getPasswordAuthentication() {
    				return new PasswordAuthentication("seleniumtest201@gmail.com", "Admin12!@");
    			}
    		});
    		try {
    
    			// Create object of MimeMessage class
    			Message message = new MimeMessage(session);
    
    			// Set the from address
    			message.setFrom(new InternetAddress("seleniumtest201@gmail.com"));
    
    			// Set the recipient address
    			message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("aniketgupta1993@gmail.com"));
    
    			// Add the subject link
    			message.setSubject("Test Case Execution Report");
    
    			// Create object to add multi media type content
    			BodyPart messageBodyPart1 = new MimeBodyPart();
    
    			// Set the body of email
    			messageBodyPart1.setText("This is auto-generated test case execution report");
    
    			// Create another object to add another content
    			MimeBodyPart messageBodyPart2 = new MimeBodyPart();
    
    			// Mention the file which you want to send
    			String filename = "C://Users//aniket//sampleseleniumproject//test-output//emailable-report.html";
    
    			// Create data source and pass the filename
    			DataSource source = new FileDataSource(filename);
    
    			// set the handler
    			messageBodyPart2.setDataHandler(new DataHandler(source));
    
    			// set the file
    			messageBodyPart2.setFileName(filename);
    
    			// Create object of MimeMultipart class
    			Multipart multipart = new MimeMultipart();
    
    			// add body part 1
    			multipart.addBodyPart(messageBodyPart2);
    
    			// add body part 2
    			multipart.addBodyPart(messageBodyPart1);
    
    			// set the content
    			message.setContent(multipart);
    
    			// finally send the email
    			Transport.send(message);
    
    			System.out.println("=====Email Sent=====");
    
    		} catch (MessagingException e) {
    
    			throw new RuntimeException(e);
    		}
    	}
    }