![]() |
|
Email script error message RCPT - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Email script error message RCPT (/showthread.php?tid=4531) |
Email script error message RCPT - victor.back - 25.01.2023 Hi I get an error message in log when running an script for sending an email. the email got thru but dont know what this message meen? RE: Email script error message RCPT - admin - 25.01.2023 Check that settings.rcpt in the mail() function is present and to is not empty. RE: Email script error message RCPT - victor.back - 25.01.2023 (25.01.2023, 10:43)admin Wrote: Check that settings.rcpt in the mail() function is present and to is not empty.Don´t see that it is, heres the mail() function script Code: -- send an e-mail
function mail(to, subject, message)
-- make sure these settings are correct
local settings = {
-- "from" field, only e-mail must be specified here
from = 'xxxxx',
-- smtp username
user = 'xxxxx',
-- smtp password
password = 'xxxxx',
-- smtp server
server = 'smtp01.binero.se',
-- smtp server port
port = 465,
-- enable tls, required for gmail smtp
secure = 'sslv23',
}
local smtp = require('socket.smtp')
if type(to) ~= 'table' then
to = { to }
end
for index, email in ipairs(to) do
to[ index ] = '<' .. tostring(email) .. '>'
end
-- fixup from field
local from = '<' .. tostring(settings.from) .. '>'
-- message headers and body
settings.source = smtp.message({
headers = {
to = table.concat(to, ', '),
subject = subject,
['From'] = from,
['Content-type'] = 'text/html; charset=utf-8',
},
body = message
})
settings.from = from
settings.rcpt = to
return smtp.send(settings)
endRE: Email script error message RCPT - admin - 25.01.2023 A possible cause is that "from" field contains a non-existing address. Also some servers require "POP before SMTP" authentication method which is not possible with LM. |