Support Article
STARTTLS command error when attempting to send email
SA-3921
Summary
User is getting STARTTLS command error when work object assignment was completed and an email was sent.
Error Messages
RSET
530 5.7.0 Must issue a STARTTLS command first
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first
at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1481)
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1512)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1054)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:634)
at com.pegarules.generated.SendEmail_060301_fRsW0ypFA$R$kEhMbIxIEA.SendEmail06_03_01(SendEmail_060301_fRsW0ypFA$R$kEhMbIxIEA.java:548)
at com.pegarules.generated.SendEmail_060301_fRsW0ypFA$R$kEhMbIxIEA.invoke(SendEmail_060301_fRsW0ypFA$R$kEhMbIxIEA.java:85)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.resolveAndinvokeFunctionViaReflection(LibraryRuntime.java:132)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.invokeLibraryRuntime(LibraryRuntime.java:109)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeLibraryRuntime(Executable.java:7975)
at com.pega.pegarules.priv.generator.LibrarySupport.resolveAndInvokeFunctionViaReflection(LibrarySupport.java:181)
at com.pegarules.generated.pega_procom_default.SendEmail(pega_procom_default.java:495)
at com.pegarules.generated.SendEmail_060301_kaSUYgL_GJOPaiEflJnBMA.SendEmail06_03_01(SendEmail_060301_kaSUYgL_GJOPaiEflJnBMA.java:148)
at com.pegarules.generated.SendEmail_060301_kaSUYgL_GJOPaiEflJnBMA.invoke(SendEmail_060301_kaSUYgL_GJOPaiEflJnBMA.java:85)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.resolveAndinvokeFunctionViaReflection(LibraryRuntime.java:132)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.invokeLibraryRuntime(LibraryRuntime.java:109)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeLibraryRuntime(Executable.java:7975)
at com.pega.pegarules.priv.generator.LibrarySupport.resolveAndInvokeFunctionViaReflection(LibrarySupport.java:181)
at com.pegarules.generated.pega_procom_default.SendEmail(pega_procom_default.java:486)
at com.pegarules.generated.activity.ra_action_sendemailnotification_797cc29fc91489b84ca5f27803ceaa7b.step3_circum0(ra_action_sendemailnotification_797cc29fc91489b84ca5f27803ceaa7b.java:472)
at com.pegarules.generated.activity.ra_action_sendemailnotification_797cc29fc91489b84ca5f27803ceaa7b.perform(ra_action_sendemailnotification_797cc29fc91489b84ca5f27803ceaa7b.java:89)
Root Cause
The host "smtp1.server.com", port: 25 throws error 530 5.7.0 Must issue a STARTTLS command first, however for the same host on port: 587 it works fine.
RESOLUTION DETAILS
User was using an older version of SendEmail R-U-Function SendEmail--(String,String,String8af598a1219daf6f486ba0ad9c2e28ee) which does not have STARTTLS option enabled. This parameter is already enabled in the latest code under SendEmailMessage rule (6.3) which was not used by the user.
Following code was included in their legacy SendEmail R-U-F :
props.put("mail.smtp.starttls.enable", "true");
This configuration worked in one of their lower environment where both 25 and 587 ports were TLS enabled.
In their higher environment, only 587 port was TLS enabled. To verify the actual SMTP working configuration, wrote a custom code which connects to the email server by hardcoding the port numbers 25 and 587. In these tests, it was found that email listener was listening on port 587 and on 25 failing with "530 5.7.0 Must issue a STARTTLS command first". User was advised to modify the Mail Server configuration in PRPC to use SMTP SSL port 587 instead of 25 in this environment.
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.