lua-resty-smtp icon indicating copy to clipboard operation
lua-resty-smtp copied to clipboard

smtp.lua:124: 500 Error: bad syntax

Open feifei325 opened this issue 6 years ago • 2 comments

`ngx.header.content_type="application/json;charset=utf8"; local function send_mail() local smtp = require("resty.smtp") local mime = require("resty.smtp.mime") local ltn12 = require("resty.smtp.ltn12")

ngx.log(ngx.ERR, "Sending test mail...")

local subject = "mail with attachment"
local body = "mail plain text body"
local from ="[email protected]"
local to = {"[email protected]"}

local attachment_content_type = "text/plain"
local attachment_file_name = "README.md"
local attachment = "You got me"


local mesgt = {
headers= {
    subject= mime.ew(subject, nil,
                     { charset= "utf-8" }),
    ["content-transfer-encoding"]= "BASE64",
    ["content-type"]= "text/plain; charset='utf-8'",
},

body= mime.b64("aaaaa")
}

local ret, err = smtp.send {
    from = from,
    rcpt = to,
    user =from,
    password = '********',
    server ='smtp.mxhichina.com',
    port = 25,
    domain = "*.*.*.*",
    source = smtp.message(mesgt),
    ssl = { enable = false , verify_cert = false }
}

ngx.log(ngx.ERR, from,"111111")


if err then
    ngx.log(ngx.ERR, err,"111111")
end

end

send_mail()

ngx.say("OK") ngx.exit(200) `

feifei325 avatar Jan 08 '19 13:01 feifei325

Anyway, I try to modify the domain, server, and recipient formats to report syntax errors. However, using python code to try to send mail can be sent successfully.

feifei325 avatar Jan 09 '19 02:01 feifei325

i got this problem too,is this project still alive?

tingyunsay avatar May 11 '20 09:05 tingyunsay