Logic Machine Forum
email notification - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: email notification (/showthread.php?tid=226)



email notification - Peter - 22.02.2016

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


RE: email notification - admin - 23.02.2016

log() the result of mail() function, it should tell why it cannot be sent


RE: email notification - PassivPluss - 18.10.2016

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



RE: email notification - PassivPluss - 26.10.2016

Dies anybody else have running/working email script on last rc of firmware?


RE: email notification - admin - 27.10.2016

Please try installing this package through System config -> Packages and try again:
https://dl.openrb.com/lm-16.09-rc2/libwolfssl_3.9.10-1_mxs.ipk


RE: email notification - AEK - 27.10.2016

(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/libwolfssl_3.9.10-1_mxs.ipk

it works! just tested


RE: email notification - buuuudzik - 27.10.2016

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



RE: email notification - admin - 27.10.2016

Which firmware are you running? This will only work with RC2.


RE: email notification - buuuudzik - 27.10.2016

(27.10.2016, 18:02)admin Wrote: Which firmware are you running? This will only work with RC2.

Version: 20160927


RE: email notification - admin - 27.10.2016

Load balancer?


RE: email notification - buuuudzik - 27.10.2016

(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


RE: email notification - admin - 28.10.2016

You to install this package for Load Balancer:
https://dl.openrb.com/lm-16.09-rc2/libwolfssl_3.9.10-1_x86.ipk


RE: email notification - buuuudzik - 28.10.2016

(28.10.2016, 06:42)admin Wrote: You to install this package for Load Balancer:
https://dl.openrb.com/lm-16.09-rc2/libwolfssl_3.9.10-1_x86.ipk

It works. Nice Smile


RE: email notification - PassivPluss - 30.10.2016

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...