Many of java learners when work on project, they need to send email to their clients for different purposes like on successful registration or a information for some event and so on.
This video is concerned about "how to send email using java" and i guess it will help you better in completing your project work.
if someone had the following error:
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. j34sm2621444uaa.37 - gsmtp at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1020) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:716) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:388) at com.prueba.EmailSender.sendMail(EmailSender.java:44) at com.prueba.Demo.main(Demo.java:11)
Just replace this:
// props.put("mail.smtp.starttls.enable", "true"); // props.put("mail.smtp.host", host); // props.put("mail.smtp.user", from); // props.put("mail.smtp.password", password); // props.put("mail.smtp.port", 587); // props.put("mail.smtp.auth", "true"); // props.put("mail.smtp.ssl.trust","smtp.gmail.com");
For this:
props.put("mail.smtp.user","username"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "25"); props.put("mail.debug", "true"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable","true"); props.put("mail.smtp.EnableSSL.enable","true");
Be the First to Respond
Share Your Thoughts