aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. i20sm7448258wff.17 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. i20sm7448258wff.17" Watch "javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. i20sm7448258wff.17" New topic
Author

javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. i20sm7448258wff.17

Ramasubramaniam Rathinasubbu
Ranch Hand

Joined: Jun 09, 2010
Posts: 44
Dear all,

I got this problem when i send the mail

OS : Linux
Application server : jboss

javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. i20sm7448258wff.17

javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. i20sm7448258wff.17
2010-09-27 19:27:16,076 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:879)
2010-09-27 19:27:16,076 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:599)
2010-09-27 19:27:16,076 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:319)
2010-09-27 19:27:16,076 ERROR [STDERR] at javax.mail.Transport.send0(Transport.java:164)
2010-09-27 19:27:16,076 ERROR [STDERR] at javax.mail.Transport.send(Transport.java:81)
2010-09-27 19:27:16,076 ERROR [STDERR] at SendMail.callMailServer(SendMail.java:122)
2010-09-27 19:27:16,076 ERROR [STDERR] at SendEmail.doGet(SendEMail.java:24)
2010-09-27 19:27:16,076 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
2010-09-27 19:27:16,076 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
2010-09-27 19:27:16,076 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
2010-09-27 19:27:16,077 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
2010-09-27 19:27:16,077 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)


This is my code

Properties props = new Properties();
props.put("mail.smtp.user",emailusername);
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "25");
props.put("mail.debug", "true");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.socketFactory.port", "25");
// props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
String m_subject = "sample subject";
String message_str = "sample Message";
//out.println(strbuffer.toString());
SecurityManager security = System.getSecurityManager();
//Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
MimeMessage msg = new MimeMessage(session);
msg.setContent(message_str, "text/html");
msg.setSubject(m_subject);

InternetAddress addressFrom = new InternetAddress(d_email);
msg.setFrom(addressFrom);
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse((sendto), false));
msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse((sendcc), false));
Transport.send(msg);


}
catch (Exception mex)
{
mex.printStackTrace();
}
}
private class SMTPAuthenticator extends javax.mail.Authenticator
{
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(emailusername,password);
}
}
}

Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have you seen this?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ramasubramaniam Rathinasubbu
Ranch Hand

Joined: Jun 09, 2010
Posts: 44

I have used same, but nothing is coming.
Properties props = new Properties();
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.user", "subbu.rams@gmail.com");
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.socketFactory.port", "25");
// props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
SecurityManager security = System.getSecurityManager();
//Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
MimeMessage msg = new MimeMessage(session);
msg.setContent("sample Message", "text/html");
msg.setSubject("sample Subject");

2010-09-28 12:29:23,080 ERROR [STDERR] javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. c14sm8413306wfe.14
2010-09-28 12:29:23,080 ERROR [STDERR] at javax.mail.Transport.send0(Transport.java:219)
2010-09-28 12:29:23,080 ERROR [STDERR] at javax.mail.Transport.send(Transport.java:81)
2010-09-28 12:29:23,080 ERROR [STDERR] at JavaMail.doGet(JavaMail.java:136)
2010-09-28 12:29:23,080 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
2010-09-28 12:29:23,080 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
2010-09-28 12:29:23,080 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
2010-09-28 12:29:23,080 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
2010-09-28 12:29:44,3
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. i20sm7448258wff.17