email sending - Fistel - 05.05.2025
Morning i'm trying to send Email
i followed the steps in the manuel attached, but i can't send email
RE: email sending - Daniel - 05.05.2025
Log what the mail function returns as suggested here: https://forum.logicmachine.net/showthread.php?tid=5242&pid=33911#pid33911
RE: email sending - Erwin van der Zwart - 05.05.2025
Are you using gmail? If yes did you created an app password in your gmail account and use that in your script?
RE: email sending - Fistel - 06.05.2025
(05.05.2025, 08:48)Daniel Wrote: Log what the mail function returns as suggested here: https://forum.logicmachine.net/showthread.php?tid=5242&pid=33911#pid33911 This is what i have from log
Code: * arg: 1
* nil
* arg: 2
* string: 535-5.7.8 Username and Password not accepted. For more information, go to
535 5.7.8 https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5fa77bf1e35sm8035646a12.66 - gsmtp
This is the function i used :
Code: function Email(to, subject, message)
-- make sure these settings are correct
---------------BEGINNING OF USER EDITABLE AREA-------------------
local settings = {
-- "from" field, only e-mail must be specified here
from = 'nguenangulrich6@gmail.com',
-- smtp username
user = 'nguenangulrich6@gmail.com',
-- smtp password
password = '***',
-- smtp server
server = 'smtp.gmail.com',
-- smtp server port
port = 465,
-- enable ssl, required for gmail smtp
secure = 'sslv23',
}
-------------------END OF USER EDITABLE AREA---------------------
local smtp = require('socket.smtp')
local escape = function(v)
return '<' .. tostring(v) .. '>'
end
-- message headers and body
settings.source = smtp.message({
headers = {
to = escape(to),
subject = subject,
},
body = message
})
-- fixup from field
settings.from = escape(settings.from)
settings.rcpt = { escape(to) }
return smtp.send(settings)
end
the gmail acount i created is "nguenangulrich6@gmail.com" and the pasword "***"
(05.05.2025, 08:55)Erwin van der Zwart Wrote: Are you using gmail? If yes did you created an app password in your gmail account and use that in your script?
Yes, like in the above message
RE: email sending - admin - 07.05.2025
You need to enable 2FA and the create app password: https://myaccount.google.com/apppasswords
When adding password to your script remove all spaces so only 16 characters are left.
RE: email sending - Fistel - 07.05.2025
(06.05.2025, 16:51)Fistel Wrote: (05.05.2025, 08:48)Daniel Wrote: Log what the mail function returns as suggested here: https://forum.logicmachine.net/showthread.php?tid=5242&pid=33911#pid33911 This is what i have from log
Code: * arg: 1
* nil
* arg: 2
* string: 535-5.7.8 Username and Password not accepted. For more information, go to
535 5.7.8 https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5fa77bf1e35sm8035646a12.66 - gsmtp
This is the function i used :
Code: function Email(to, subject, message)
-- make sure these settings are correct
---------------BEGINNING OF USER EDITABLE AREA-------------------
local settings = {
-- "from" field, only e-mail must be specified here
from = 'nguenangulrich6@gmail.com',
-- smtp username
user = 'nguenangulrich6@gmail.com',
-- smtp password
password = '***',
-- smtp server
server = 'smtp.gmail.com',
-- smtp server port
port = 465,
-- enable ssl, required for gmail smtp
secure = 'sslv23',
}
-------------------END OF USER EDITABLE AREA---------------------
local smtp = require('socket.smtp')
local escape = function(v)
return '<' .. tostring(v) .. '>'
end
-- message headers and body
settings.source = smtp.message({
headers = {
to = escape(to),
subject = subject,
},
body = message
})
-- fixup from field
settings.from = escape(settings.from)
settings.rcpt = { escape(to) }
return smtp.send(settings)
end
the gmail acount i created is "nguenangulrich6@gmail.com" and the pasword "***"
(05.05.2025, 08:55)Erwin van der Zwart Wrote: Are you using gmail? If yes did you created an app password in your gmail account and use that in your script?
Yes, like in the above message Thank's, it's OK now
|