Posts: 51
Threads: 14
Joined: Jul 2015
Reputation:
1
Hello guys,
I have some problems with email notification. Using the script example from here LINK does not generally work. I can send emails to my companys' other email address but that is just thanks to less strict policies when sending from one our email address to another. I can see there is missing "from" field in my received message, eventhough I am quite sure I did the configuration of the script right.
Anybode else having this same issue?
Thank you
Peter
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
log() the result of mail() function, it should tell why it cannot be sent
Posts: 176
Threads: 42
Joined: Jul 2015
Reputation:
2
Hi
Yesterday i programmed the email notification from www.openrb.com examples. I tried to update to latest version on my LM now and the mail sending doesnt work anymore. How do I fix it?
I am using the code underneath and have made the gmail account allow unsure apps.
event based
mail('exampe@gmail.com', 'Alert', 'KNX object 1/2/2 value is')
common functions
- -- 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 = 'example@gmail.com',
- -- smtp username
- user = 'example@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',
- }
-
- 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
Posts: 176
Threads: 42
Joined: Jul 2015
Reputation:
2
Dies anybody else have running/working email script on last rc of firmware?
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Please try installing this package through System config -> Packages and try again:
https://dl.openrb.com/lm-16.09-rc2/libwo...-1_mxs.ipk
Posts: 155
Threads: 12
Joined: Sep 2015
Reputation:
13
(27.10.2016, 07:16)admin Wrote: Please try installing this package through System config -> Packages and try again:
https://dl.openrb.com/lm-16.09-rc2/libwo...-1_mxs.ipk
it works! just tested
Posts: 940
Threads: 161
Joined: Jul 2015
Reputation:
33
I installed this package and I am using this 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 = 'my@gmail.com',
-- smtp username
user = 'my@gmail.com',
-- smtp password
password = 'my_password',
-- smtp server
server = 'smtp.gmail.com',
-- smtp server port
port = 465,
-- enable ssl, 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
-- 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
and when I am trying to use this script I have the answer:
Code: * arg: 1
* nil
* arg: 2
* string: revcd alert fatal error
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Which firmware are you running? This will only work with RC2.
Posts: 940
Threads: 161
Joined: Jul 2015
Reputation:
33
(27.10.2016, 18:02)admin Wrote: Which firmware are you running? This will only work with RC2.
Version: 20160927
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Posts: 940
Threads: 161
Joined: Jul 2015
Reputation:
33
27.10.2016, 21:12
(This post was last modified: 27.10.2016, 21:28 by buuuudzik.)
(27.10.2016, 18:15)admin Wrote: Load balancer?
Yes, this is LM Load Balancer but I will check also on the LM4
This is from LM4:
Code: * arg: 1
* nil
* arg: 2
* string: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbv3
534-5.7.14 B4a0GJrvUSCidM5P03E1SsXID36ZOcEUAcaehwrepStPcHe0aoR1xRL-V1F_qWhgaiQFgJ
534-5.7.14 FzcpqA2Y8mV80gWO4TzLzCBPuDwMj0tvsuwVMxCxIpBp-Zf1cGXoZEKjstdduN61_SOB3M
534-5.7.14 wMhNNh1JuVg7MMR2WvevrCJk_M9PaP6EFCT_y9VJvQZpaV_7d7H2bh_OcSUXB1wBxuBZJr
534-5.7.14 629FJG8MK3aeOXfYu5gk7MRwtwRhM> Please log in via your web browser and
534-5.7.14 then try again.
534-5.7.14 Learn more at
534 5.7.14 https://support.google.com/mail/answer/78754 h68sm1557090lji.20 - gsmtp
After some additional logging and confirming LM connections as a safe it works ok, but not from 1 try after doing change, but this is google policy But if this is about Load Balancer it not works and the problem is the same stiill
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Posts: 940
Threads: 161
Joined: Jul 2015
Reputation:
33
(28.10.2016, 06:42)admin Wrote: You to install this package for Load Balancer:
https://dl.openrb.com/lm-16.09-rc2/libwo...-1_x86.ipk
It works. Nice
Posts: 176
Threads: 42
Joined: Jul 2015
Reputation:
2
The package works. Note to admin: U should edit post were the firmware update is to also include this package. And other bugfixes like this. That way other users dont have to waste a couple of hours looking for a fault in their own scripting...
|