Logic Machine Forum
send mail from gmail - 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: send mail from gmail (/showthread.php?tid=2708)



send mail from gmail - Angeles - 02.07.2020

Hi:
Since January it is not possible send mail from account gmail:
server = 'smtp.gmail.com',
    -- smtp server port
    port = 465,
    -- enable ssl, required for gmail smtp
secure = 'sslv23'


The configuration of client mail is:
REQUIRED SSL YES
REQUIRED TLS YES
PORT 587

I have changed the configuration and it doesn't work.

Thanks.


RE: send mail from gmail - Daniel - 02.07.2020

Hi use
secure = 'tlsv1_2',


RE: send mail from gmail - Angeles - 02.07.2020

(02.07.2020, 08:32)Daniel. Wrote: Hi use
  secure = 'tlsv1_2',
I've used that and  it doesn't work

Log

* arg: 1
* nil
* arg: 2
* string: closed


RE: send mail from gmail - Daniel - 02.07.2020

what FW do you use?


RE: send mail from gmail - Angeles - 02.07.2020

(02.07.2020, 08:51)Daniel. Wrote: what FW do you use?
I have several devices with differente FIRMWARE... and the same email configuration. One of them is 20170620


RE: send mail from gmail - Daniel - 02.07.2020

Can you try updating to RC1?


RE: send mail from gmail - Erwin van der Zwart - 02.07.2020

Hi,

I have seen projects that are using a backup with older common function and that was the problem with mail..

Check if the function mail is like below:

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 = 'user@gmail.com',
    -- smtp username
    user = 'user@gmail.com',
    -- smtp password
    password = 'password',
    -- smtp server
    server = 'smtp.gmail.com',
    -- smtp server port
    port = 465,
    -- enable tls, required for gmail smtp
    secure = 'tlsv1_2',
  }

  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

  -- fixup from field
  local from = '<' .. tostring(settings.from) .. '>'

  -- message headers and body
  settings.source = smtp.message({
    headers = {
      to = table.concat(to, ', '),
      subject = subject,
      ['From'] = from,
      ['Content-type'] = 'text/html; charset=utf-8',
    },
    body = message
  })

  settings.from = from
  settings.rcpt = to
  res, err = smtp.send(settings)
  return res,err
end
BR,

Erwin


RE: send mail from gmail - Krstfr2k - 03.07.2020

I had an issue where a cellphone was connected to the same Gmail account as I am using for alerts from LM, and the phone automaticly disabled the feature which accepts less secure applications. I had to remove the gmail account from the phone.