Im working with alarms and I need to send an Email when any alarm is triggered, I download an example named Email and Sms, but when I fill toEmail, fromEmail, passFromEmail and smtp server and test send email I got Error sending message: Failure sending mail and I dont know what can be happend
But if I left blank the toEmail, it say message sent, reading the scripts I suspect that the problem can occur in line 20
Because when its not true, the script can execute the try, but when that if its true the try fail and the catch its execute. Here is a screenshot of the complete script
Also, line 13 use port 587 and line 15 enable SSL security but 587 its the port for TLS, SSL use 465, I change it a test but it doesnt work, I dont know if thats ok or if I have to change it and make another fix.
I think too that a 2 steps authentication of the fromEmail can be generating the problem
Thank you for reaching out to us.
Regarding the issue you encountered while attempting to send an email when an alarm is triggered, it seems that the error message you received is due to an incorrect password or SMTP server configuration.
If you are utilizing Gmail’s SMTP server, we recommend creating an “App Password” to bypass the two-step authentication. To accomplish this, please follow the link provided below:
Google Mail Support: Creating an App Password (Sign in with app passwords - Gmail Help)
Once you have generated the app password, please ensure that the SMTP server field is set to: smtp.gmail.com
Please let us know if this solution resolves the issue for you.
Thanks! it works, also hotmail dont need that app password but it needs to use smtp-mail.outlook.com instead smtp.live.com as SMTP server, in case anyone else need this information