08.05.2021, 21:44
I am using the standard script to send email. LM5 v20191015.
No matter what host I set in server, I get an error about "string: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials c5sm15367699wrs.73 - gsmtp"
Why on earth would GOOGLE be there if I ask it to go to "sss" ???
How can I debug this?
I have tried all the combination of 'secure' found on the forum in various posts over the years; this is really confusing but in any case does not change anything since GOOGLE is always back as error.
Thanks for any help or pointers
function mail(to, subject, message)
-- make sure these settings are correct
local settings = {
-- "from" field, only e-mail must be specified here
from = '...',
-- smtp username
user = '...',
-- smtp password
password = '...',
-- smtp server
server = 'sss',
-- smtp server port
port = 465,
secure = 'tlsv12',
-- use STARTTLS mode
--starttls = true,
}
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
-- message headers and body
settings.source = smtp.message({
headers = {
to = table.concat(to, ', '),
subject = subject,
['Content-type'] = 'text/html; charset=utf-8',
},
body = message
})
-- fixup from field
settings.from = '<' .. tostring(settings.from) .. '>'
settings.rcpt = to
return smtp.send(settings)
end
No matter what host I set in server, I get an error about "string: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials c5sm15367699wrs.73 - gsmtp"
Why on earth would GOOGLE be there if I ask it to go to "sss" ???
How can I debug this?
I have tried all the combination of 'secure' found on the forum in various posts over the years; this is really confusing but in any case does not change anything since GOOGLE is always back as error.
Thanks for any help or pointers
function mail(to, subject, message)
-- make sure these settings are correct
local settings = {
-- "from" field, only e-mail must be specified here
from = '...',
-- smtp username
user = '...',
-- smtp password
password = '...',
-- smtp server
server = 'sss',
-- smtp server port
port = 465,
secure = 'tlsv12',
-- use STARTTLS mode
--starttls = true,
}
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
-- message headers and body
settings.source = smtp.message({
headers = {
to = table.concat(to, ', '),
subject = subject,
['Content-type'] = 'text/html; charset=utf-8',
},
body = message
})
-- fixup from field
settings.from = '<' .. tostring(settings.from) .. '>'
settings.rcpt = to
return smtp.send(settings)
end