GUI / lua-resty-mail

A high-level, easy to use, and non-blocking email and SMTP library for OpenResty.
MIT License
66 stars 16 forks source link

Example code missing items #7

Closed Maxxxxxx-x closed 2 years ago

Maxxxxxx-x commented 2 years ago

It seems like using tls will cause a Lua TCP socket read timed out

With tls set to false, receive_response (line 8) also throws a time out in the while loop's socket:receive() line

Maxxxxxx-x commented 2 years ago

Update: I have managed to narrow it down to being a 504 Unrecognized Authentication Type, image Currently using Port 587 with STARTTLS as true

Maxxxxxx-x commented 2 years ago

I resolved the issue by adding in a auth_type to mailer

local mailer, err = mail.new({
        host = mail.group.com.hk,
        port = 587,
        starttls = true, --based on your port
        username = Username,
        password = "password",
        auth_type = "login"
    })

    if err then
        ngx.log(ngx.ERR, "mailer error: ", err)
        return ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
    end