Hi Ignition Lovers,
I’m seeing inconsistent SMTP behavior in my Ignition environment and would appreciate your help.
Summary
-
Gateway “Send Test Email” (Config → Network → Email Settings → my profile) works.
-
Sending from a script (Script Console) fails with:
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first
-
I need to trigger a Report and email it asynchronously from a button.
Environment
-
Ignition Gateway: version 8.1.48 on Windows 11
-
SMTP provider: Gmail
-
Email Profile name: A
-
Profile settings currently:
-
Host:
smtp.gmail.com
-
Port: 587
-
Use STARTTLS: enabled
-
Use SSL/TLS port: disabled
-
Require authentication: enabled
-
Username / From:
xmedxxxc97@gmail.com
-
Password: Google App Password
-
Steps to Reproduce
-
In Gateway, create/update the Email Profile A with the settings above.
-
Click Send Test Email → email is delivered successfully.
-
In Designer, run the simplest send (and also from a button):
system.net.sendEmail( smtp = "smtp.gmail.com", # exact SMTP fromAddr = "xmedxxxc97@gmail.com", # same as profile username to = ["xmedxxxc@gmail.com"], # Another GMAIL account as destinatary subject = "SMTP test", body = "Hi, the email is here" )
-
Result: failure with GatewayException; Java cause:
com.sun.mail.smtp.SMTPSendFailedException: 530-5.7.0 Must issue a STARTTLS command first
(When I trigger a report and attach its bytes, the same error occurs.)
What I’ve Tried
-
Verified the profile by sending the Gateway test (works).
-
Ensured the script calls the same profile name (“A”).
-
Confirmed From == Username and I’m using a Gmail App Password.
-
Verified basic connectivity to smtp.gmail.com:587/465 from the machine.
-
Reviewed logs (snippet below).
Log Snippet
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530-5.7.0 Must issue a STARTTLS command first. ...
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1300)
...
The error have a poor description of the cause explained for Google here :
https://support.google.com/a/answer/3726730?hl=es&ref_topic=1355150&sjid=8121797102622003986-NA#
Questions
-
Is there any known issue/limitation where system.net.sendEmail from Client/Designer scope might not honor the STARTTLS/SSL settings of the named Email Profile—even though the Gateway “Send Test Email” does?
-
Is there a recommended way to guarantee the email is sent in Gateway scope using the same profile (e.g., via
system.util.sendRequest
to a Gateway Message Handler) to avoid scope-related differences? -
Any additional logging flags for JavaMail in Ignition to confirm the STARTTLS handshake when called from scripts?