Posts: 4
Threads: 1
Joined: May 2022
Reputation:
0
Hi ! I'm looking for help regarding an email sending script with a Wiser for KNX.
I already looked into many subjects on this forum but i can't keep send any email with my server.
I link my entire project.
Thanks for the help.
Posts: 7769
Threads: 42
Joined: Jun 2015
Reputation:
447
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.
Posts: 38
Threads: 10
Joined: Dec 2017
Reputation:
0
Hello admin, could you recommend any alternative to gmail that you know works?
I have a client who wants to use his gmail, but he has two-factor authentication and from what I see it is no longer possible by script.
Posts: 7769
Threads: 42
Joined: Jun 2015
Reputation:
447
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.
Posts: 4
Threads: 1
Joined: May 2022
Reputation:
0
(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 :/
Posts: 7769
Threads: 42
Joined: Jun 2015
Reputation:
447
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: res, err = mail(...)
log(res, err)
Posts: 4
Threads: 1
Joined: May 2022
Reputation:
0
(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: res, err = mail(...)
log(res, err)
Where can i check it ? When i save the script i got 0 error message
Posts: 7769
Threads: 42
Joined: Jun 2015
Reputation:
447
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.
Posts: 4
Threads: 1
Joined: May 2022
Reputation:
0
(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 ?
Posts: 7769
Threads: 42
Joined: Jun 2015
Reputation:
447
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
Posts: 38
Threads: 10
Joined: Dec 2017
Reputation:
0
(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.
Posts: 7
Threads: 0
Joined: Aug 2020
Reputation:
2
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
Posts: 3
Threads: 0
Joined: Jun 2022
Reputation:
0
(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
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
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor [...]
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.
Posts: 167
Threads: 20
Joined: Apr 2017
Reputation:
2
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
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor [...]
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',
}
Posts: 3
Threads: 0
Joined: Jun 2022
Reputation:
0
(19.06.2022, 10:58)Dré Wrote: (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
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor [...]
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) ?
Posts: 7769
Threads: 42
Joined: Jun 2015
Reputation:
447
Device certificate is not used for sending e-mails. I've also tried sending through Gmail with App password and it works for me.
Posts: 3
Threads: 0
Joined: Jun 2022
Reputation:
0
Rebooting the device made it work somehow. I can use gmail now. Thank you all for your answers!
Posts: 4
Threads: 2
Joined: Apr 2018
Reputation:
0
(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) }
return smtp.send(settings)
end
|