Don't share project files directly as they might contain some sensitive information.
Gmail has recently changed security policy. It requires two-factor authentication so sending from scripts might not possible anymore. You need to use a different e-mail provider.
There are services that can be used for sending only like sendgrid.com (free for low message volumes), but they require a domain name to be attached to the service.
Depending on the task different services can used, for example Telegram is more suitable for notifications than e-mail.
(02.06.2022, 08:11)admin Wrote: Don't share project files directly as they might contain some sensitive information.
Gmail has recently changed security policy. It requires two-factor authentication so sending from scripts might not possible anymore. You need to use a different e-mail provider.
Thanks for the tips
Do you have the secure method of outlook ?
Neither of "secure = sslv23" and "secure = STARTLLS" are working and i don't know where to find it :/
STARTTLS uses a different port - most often 587. While standard SSL/TLS uses 465. Also check what the email function returns, it might tell you where the error is:
(03.06.2022, 07:28)admin Wrote: STARTTLS uses a different port - most often 587. While standard SSL/TLS uses 465. Also check what the email function returns, it might tell you where the error is:
Code:
12
res, err = mail(...)
log(res, err)
Where can i check it ? When i save the script i got 0 error message
Check Logs tab. Only syntax errors are displayed when saving. This error is returned by the mail() function and is not logged anywhere unless you add log() call afterwards.
(03.06.2022, 07:36)admin Wrote: Check Logs tab. Only syntax errors are displayed when saving. This error is returned by the mail() function and is not logged anywhere unless you add log() call afterwards.
Alright so i don't have any log error but my mail are not going out.
I got this in mail email.user script :
-- smtp server
server = 'smtp.office365.com',
-- smtp server port
port = 587,
-- enable ssl, required for gmail smtp
secure = 'STARTTLS'
I think this is working but is there any parameters i need to activate on outlook to make this scrit working ?
You need to manually add log call after sending the e-mail as I've mentioned in the previous post. Without this info there's no way to tell why it's not sending. See point nr.4 here: https://forum.logicmachine.net/showthread.php?tid=2531
(02.06.2022, 10:10)admin Wrote: There are services that can be used for sending only like sendgrid.com (free for low message volumes), but they require a domain name to be attached to the service.
Depending on the task different services can used, for example Telegram is more suitable for notifications than e-mail.
Thank you, I'll try with a simple gmail account or with telegram.
My gmail scripts suddenly stopped working as well. Apparently google stopped supporting applications that do not provide the required security level as from May 30.
However there's a workaround => enable the 2 step authentication in your google account and then create a specific application password for the app (LogicMachine/W4K) that you want to use without the need for 2-step authentication. Copy the password you created and use this as the password in your lua script in stead of your normal google account password.
This worked for me....
My gmail scripts suddenly stopped working as well. Apparently google stopped supporting applications that do not provide the required security level as from May 30.
However there's a workaround => enable the 2 step authentication in your google account and then create a specific application password for the app (LogicMachine/W4K) that you want to use without the need for 2-step authentication. Copy the password you created and use this as the password in your lua script in stead of your normal google account password.
This worked for me....
Thijs
Hi,
I have the same issue and I'm glad I could find your answer. However, it does not appear to work for me. Even though I set up a new application password and put it in the email function parameter structure as regular password, I still get the following error:
534-5.7.9 Application-specific password required. Learn more at
Would you mind sharing what you put in the "server", "port" and "secure" fields?
Also, what is supposed to be in the "user" field?
Note that I have managed to send emails through another, less secure provider. I am still willing to use gmail though ; I believe 2 step auth is becoming a standard.
19.06.2022, 10:58 (This post was last modified: 19.06.2022, 11:03 by Dré.)
(09.06.2022, 20:17)christiaens.t Wrote: Hi,
My gmail scripts suddenly stopped working as well. Apparently google stopped supporting applications that do not provide the required security level as from May 30.
However there's a workaround => enable the 2 step authentication in your google account and then create a specific application password for the app (LogicMachine/W4K) that you want to use without the need for 2-step authentication. Copy the password you created and use this as the password in your lua script in stead of your normal google account password.
This worked for me....
Thijs
Thanks, indeed this is working.
(15.06.2022, 12:41)SuperKNX64 Wrote: Hi,
I have the same issue and I'm glad I could find your answer. However, it does not appear to work for me. Even though I set up a new application password and put it in the email function parameter structure as regular password, I still get the following error:
534-5.7.9 Application-specific password required. Learn more at
Would you mind sharing what you put in the "server", "port" and "secure" fields?
Also, what is supposed to be in the "user" field?
Note that I have managed to send emails through another, less secure provider. I am still willing to use gmail though ; I believe 2 step auth is becoming a standard.
this are my settings for google mail;
settings = {
-- "from" field, only e-mail must be specified here
from = 'myemailadres@gmail.com',
-- smtp username
user = 'myemailadres@gmail.com',
-- smtp password
password = 'mypassword',
-- smtp server
server = 'smtp.gmail.com',
-- smtp server port
port = 465,
-- enable ssl, required for gmail smtp
secure = 'sslv23',
}
My gmail scripts suddenly stopped working as well. Apparently google stopped supporting applications that do not provide the required security level as from May 30.
However there's a workaround => enable the 2 step authentication in your google account and then create a specific application password for the app (LogicMachine/W4K) that you want to use without the need for 2-step authentication. Copy the password you created and use this as the password in your lua script in stead of your normal google account password.
This worked for me....
Thijs
Thanks, indeed this is working.
(15.06.2022, 12:41)SuperKNX64 Wrote: Hi,
I have the same issue and I'm glad I could find your answer. However, it does not appear to work for me. Even though I set up a new application password and put it in the email function parameter structure as regular password, I still get the following error:
534-5.7.9 Application-specific password required. Learn more at
Would you mind sharing what you put in the "server", "port" and "secure" fields?
Also, what is supposed to be in the "user" field?
Note that I have managed to send emails through another, less secure provider. I am still willing to use gmail though ; I believe 2 step auth is becoming a standard.
this are my settings for google mail;
settings = {
-- "from" field, only e-mail must be specified here
from = 'myemailadres@gmail.com',
-- smtp username
user = 'myemailadres@gmail.com',
-- smtp password
password = 'mypassword',
-- smtp server
server = 'smtp.gmail.com',
-- smtp server port
port = 465,
-- enable ssl, required for gmail smtp
secure = 'sslv23',
}
Hi Dré,
Thank you so much for providing me with this. However, it does not appear to solve my problem, even using an application password.
Do you believe it might be related to the device's SSL certificate authenticity (self-signed by default I believe) ?
(20.06.2022, 12:21)Hello everyone. I have a specific demand to have a "From" different for the email. I would like to have a from : Maintenance Company BMS and not an email adress. I have tried but I didnt find solution. Wrote: -- make sure these settings are correct
---------------BEGINNING OF USER EDITABLE AREA-------------------
local settings = {
-- "from" field, only e-mail must be specified here
from = 'Maintenance Company BMS',
-- smtp username
user = 'jero*****@gmail.com',
-- smtp password
password = 'wrzss****,
-- 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) }