Forum Thread: How to Send Email Using Java

How to Send Email Using Java

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( at com.sun.mail.smtp.SMTPTransport.mailFrom( at com.sun.mail.smtp.SMTPTransport.sendMessage( at com.prueba.EmailSender.sendMail( at com.prueba.Demo.main(

Just replace this:

// props.put("mail.smtp.starttls.enable", "true"); // props.put("", 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("","");

For this:

props.put("mail.smtp.user","username"); props.put("", ""); 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");

suggested by

Be the First to Respond

Share Your Thoughts