Email Address Rejected

Hello, I have the following code to send an Email when a button is pressed.

body = "Hello, this is an email."
recipients = ["buckleyliam97@gmail.com"]
system.net.sendEmail("smtp-relay.sendinblue.com",
 "seanbuckley2698@gmail.com", "Here is the email!", body, 0, recipients)

I keep getting this error…

Error running action ‘component.onActionPerformed’ on UserPage@D/root/Button: Traceback (most recent call last): File " ", line 4, in runAction nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.2 Recipient address rejected: buckleyliam97@gmail.com at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1949) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1195) at javax.mail.Transport.send0(Transport.java:254) at javax.mail.Transport.send(Transport.java:124) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:245) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:124) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities._sendEmail(GatewayNetUtilities.java:55) at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:161) at jdk.internal.reflect.GeneratedMethodAccessor245.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) javax.mail.SendFailedException: javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.2 Recipient address rejected: buckleyliam97@gmail.com

If someone knows where I am going wrong that would be great help.

Sorry, my friend. Google, Yahoo, and I imagine others have updated their DMARC policies. You can’t use a gmail account as the sender address.
https://help.sendinblue.com/hc/en-us/articles/209577705-Why-you-should-stop-using-a-Gmail-sender

1 Like

Hi Jordan, I have set up a business email using my own domain and I am still receiving an error…

Error running action ‘component.onActionPerformed’ on UserPage@D/root/Button: Traceback (most recent call last): File " ", line 4, in runAction nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.2 Recipient address rejected: buckleyliam97@gmail.com at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1949) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1195) at javax.mail.Transport.send0(Transport.java:254) at javax.mail.Transport.send(Transport.java:124) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:245) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:124) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities._sendEmail(GatewayNetUtilities.java:55) at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:161) at jdk.internal.reflect.GeneratedMethodAccessor245.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) javax.mail.SendFailedException: javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.2 Recipient address rejected: buckleyliam97@gmail.com

I have my new business email set up as a sender in my SendInBlue account and this is the code I am using…

body = "Hello, this is an email."
	recipients = ["buckleyliam97@gmail.com"]
	system.net.sendEmail("smtp-relay.sendinblue.com",
	 "notification@ticketingsystemfyp.com", "Here is the email!", body, 0, recipients)

When I test my SMTP profile it works and sends the email using the same details.
Any help is welcome.

550 5.1.2 Recipient address rejected

      X.1.2   Bad destination system address

         The destination system specified in the address does not exist
         or is incapable of accepting mail.  For Internet mail names,
         this means the address portion to the right of the "@" is
         invalid for mail.  This code is only useful for permanent
         failures.

Check that DNS is resolving for gmail.com (nslookup gmail.com), make sure port 25 is open

Can you send out to other domains?

Getting the same error with hotmail account…


Error running action 'component.onActionPerformed' on UserPage@D/root/Button: Traceback (most recent call last): File " ", line 4, in runAction nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.2 Recipient address rejected: alexoneill1998@hotmail.com  at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1949) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1195) at javax.mail.Transport.send0(Transport.java:254) at javax.mail.Transport.send(Transport.java:124) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:245) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:124) at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities._sendEmail(GatewayNetUtilities.java:55) at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:161) at jdk.internal.reflect.GeneratedMethodAccessor245.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) javax.mail.SendFailedException: javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.2 Recipient address rejected: alexoneill1998@hotmail.com

Im unsure how to check DNS is resolving for gmail and checking that port 25 is open, I am fairly new to this stuff.

If this worked when testing the SMTP profile you set up then you should be using the version of system.net.sendEmail that specifies a profile to use, not one that specifies the address of the SMTP server.

https://docs.inductiveautomation.com/display/DOC81/system.net.sendEmail

system.net.sendEmail(smtpProfile="whatever you called the SMTP profile", fromAddr="myemail@mycompany.com", subject="Here is the email!", body=body, html=1, to=recipients, cc=cc_recipients)
3 Likes

Hi Kevin, that worked there, thanks a lot, I was stuck on this for awhile.