Re: [openresty-en] Trying to send email through gmail using lua-resty-smtp

311 views
Skip to first unread message

Yichun Zhang (agentzh)

unread,
Jul 9, 2016, 11:49:29 PM7/9/16
to openresty-en
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

ary...@yahoo.com

unread,
Jul 10, 2016, 3:50:41 AM7/10/16
to openresty-en

Thank you very much!

RJoshi

unread,
Jul 12, 2016, 6:52:12 AM7/12/16
to openresty-en
thanks.

Romaboy

unread,
Jul 24, 2016, 5:32:07 AM7/24/16
to openresty-en
no resolver defined to resolve "smtp.gmail.com"
Help please with this error, I've tried duhoobo/lua-resty-smtp and recieved the same error.

Romaboy

unread,
Jul 24, 2016, 6:20:21 AM7/24/16
to openresty-en
-- assert(sock:connect("smtp.gmail.com", 465))
To:
assert(sock:connect("173.194.222.108", 465))
Do the trick! But... maybe ip will change some day... Why smpt.google.com doesn't work?

воскресенье, 24 июля 2016 г., 12:32:07 UTC+3 пользователь Romaboy написал:

Yichun Zhang (agentzh)

unread,
Jul 29, 2016, 3:55:55 PM7/29/16
to openresty-en
Reply all
Reply to author
Forward
0 new messages