Unable to Send Email Due To SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first
Symptoms
When sending a test email in Confluence, the email is not sent and the following errors are displayed:
com.atlassian.mail.MailException: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first.
at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:200)
at com.atlassian.confluence.jmx.JmxSMTPMailServer.send(JmxSMTPMailServer.java:80)
at com.atlassian.confluence.admin.actions.mail.SendTestEmailAction.execute(SendTestEmailAction.java:52)
....
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. w5sm4960856pax.28
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1515)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1054)
....
Cause
Many modern email servers require that a secure connection is established between themselves and client applications. This isn't possible to configure in the Confluence UI, and must be done by creating a JNDI resource, as detailed in Setting Up a Mail Session for the Confluence Distribution. The ability to create a secure connection to a mail server via the UI is being tracked in: CONF-18770 - Getting issue details... STATUS
This problem can also occur if the JNDI SMTP resource is incorrectly configured. Namely, the property mail.smtp.starttls.enable
is not enabled.
Resolution
- Ensure that your instance is using a "JNDI Location" (see: Setting Up a Mail Session for the Confluence Distribution).
Ensure that the SmtpServer resource section has the
mail.smtp.starttls.enable
set to "true", for example:Tomcat 5.5 or Tomcat 6<Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="smtp.gmail.com" mail.smtp.port="465" mail.smtp.auth="true" mail.smtp.user="nobody@gmail.com" password="foobar" mail.smtp.starttls.enable="true" mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory" />