Hello!
I'd like to share two minimal Lua scripts that can be used to send
emails through gmail's 2 different ports of smtp servers, using
nothing but the standard cosockets:
1.
smtp.gmail.com port 465 (SSL required)
https://gist.github.com/agentzh/d9288e4dd88941fc685598b98f74766a
2.
smtp.gmail.com port 587 (TLS required)
https://gist.github.com/agentzh/d3b1a640f0b4d1fdb45497ccb00a8763
Both of them have been tested on my side using my own gmail account.
Yeah, I love minimal stuff. Maybe I should wrap them up as an official
lua-resty-smtp library *grin*.
You can just use the "resty" command-line utility shipped with recent
OpenResty versions to run these Lua scripts. Well, just remember to
edit the sender account/password and the recipient email address
accordingly.
Well, do not send your test mail too frequently. Otherwise you may see
error messages like below from the gmail smtp server:
451 4.5.0 SMTP protocol violation, see RFC 2821 an13sm577172pac.42 - gsmtp
Good luck!
Best regards,
-agentzh