Hi, I want to send an email message from ESP8266 using the protocol SMTP. The ESP is into a factory site and want to send the message to my co-workers when an alarm is triggered. Is there some example code I can use it? Thanks.
Hi, where’s the SMTP server located? (is it a local server or is it a cloud service) Which SMTP service do you plan to use?
Hi Rui, thanks. It is a local server managed by the IT guys in the company. Regarding which service I do not know the answer but I will ask this question to them. I only want to send an email message with SMTP from the ESP8266 to my coworkers when an alarm is triggered. Thanks!
I was asking because if you just want to send an email, I recommend using the ESP with IFTTT.com. You can easily setup an account and send emails through their API with some simple HTTP client.
If you want to use a local SMTP server, it depends on the level of security (how you authenticate, if it has an SSL certificate, etc).
I think this example should work for you: https://www.electronicshub.org/send-an-email-using-esp8266/
I hope that helps and if you encounter a specific error let me know.
Thanks for your patience.
I tried the example and received the error message the sender is not allowed to send emails.Then I wend into the Google user account and enabled the Allowing Less Secure Apps. I tried again and didn’t work. I’m trying using another example and I will let you know.
But can you use Gmail? I thought you wanted to use a local SMTP server… If you just want to send an email and you can use an online platform, I recommend using IFTTT.com
Oh I got it. That’s why the examples are not working because I’m using Google Email account and trying using SMTP protocol, I’m testing at home. In fact, I created another gmail account and the same but now I know my error. Thanks. And yes, I tried using IFTTT and the ESP is able to send the email message to another Gmail account. Thank you very much for all your valuable help!!! In the future I will try using the SMTP local server. Thanks again!