This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

email notification
#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
Reply
#2
log() the result of mail() function, it should tell why it cannot be sent
Reply
#3
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

  1. -- send an e-mail,
  2. function mail(to, subject, message)
  3.  -- make sure these settings are correct
  4.  local settings = {
  5.    -- "from" field, only e-mail must be specified here
  6.    from = 'example@gmail.com',
  7.    -- smtp username
  8.    user = 'example@gmail.com',
  9.    -- smtp password
  10.    password = 'mypassword',
  11.    -- smtp server
  12.    server = 'smtp.gmail.com',
  13.    -- smtp server port
  14.    port = 465,
  15.    -- enable ssl, required for gmail smtp
  16.    secure = 'sslv23',
  17.  }
  18.  
  19.  local smtp = require('socket.smtp')
  20.  
  21.  if type(to) ~= 'table' then
  22.    to = { to }
  23.  end
  24.  
  25.  for index, email in ipairs(to) do
  26.    to[ index ] = '<' .. tostring(email) .. '>'
  27.  end
  28.  
  29.  -- message headers and body
  30.  settings.source = smtp.message({
  31.    headers = {
  32.      to = table.concat(to, ', '),
  33.      subject = subject,
  34.      ['Content-type'] = 'text/html; charset=utf-8',
  35.    },
  36.    body = message
  37.  })
  38.  
  39.  -- fixup from field
  40.  settings.from = '<' .. tostring(settings.from) .. '>'
  41.  settings.rcpt = to
  42.  
  43.  return smtp.send(settings)
  44. end
Reply
#4
Dies anybody else have running/working email script on last rc of firmware?
Reply
#5
Please try installing this package through System config -> Packages and try again:
https://dl.openrb.com/lm-16.09-rc2/libwo...-1_mxs.ipk
Reply
#6
(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
Reply
#7
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
Reply
#8
Which firmware are you running? This will only work with RC2.
Reply
#9
(27.10.2016, 18:02)admin Wrote: Which firmware are you running? This will only work with RC2.

Version: 20160927
Reply
#10
Load balancer?
Reply
#11
(27.10.2016, 18:15)admin Wrote: Load balancer?

Yes, this is LM Load Balancer but I will check also on the LM4 Smile

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 Smile  But if this is about Load Balancer it not works and the problem is the same stiill Huh
Reply
#12
You to install this package for Load Balancer:
https://dl.openrb.com/lm-16.09-rc2/libwo...-1_x86.ipk
Reply
#13
(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 Smile
Reply
#14
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...
Reply


Forum Jump: