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.

script Lua, wiser for KNX
#11
(22.09.2023, 12:40)emmanuel.dassi Wrote:
(13.09.2023, 07:49)admin Wrote: If you are not using Gmail then you also need to change the server = '...' parameter in mail() in Common functions. The standard SMTP ports are 465 or 587. For 587 you need to change secure parameter to starttls

When the email is sent successfully then the first logged argument won't be nil.

hello, I still haven't been able to solve my Mail problem, I tried with 2 different mailboxes I don't understand, here is the result of the function that I logged
test de création de fichier csv 22.09.2023 12:08:36
* arg: 1
  * nil
* arg: 2
  * string: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials n6-20020a05600c294600b0040472ad9a3dsm4302532wmd.14 - gsmtp

I remind you again that my email provider is not Google, here is the script that I took entirely from wiser without modifying anything
-- 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 = '*****@elecit.net',
    -- smtp username
    user = '*****@elecit.net',
    -- smtp password
    password = '*******',
    -- smtp server
    server = 'smtp.1und1.de',
    -- 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

  return smtp.send(settings)
end
Reply


Messages In This Thread
script Lua, wiser for KNX - by emmanuel.dassi - 01.09.2023, 12:56
RE: script Lua, wiser for KNX - by Daniel - 01.09.2023, 14:22
RE: script Lua, wiser for KNX - by admin - 12.09.2023, 14:12
RE: script Lua, wiser for KNX - by admin - 12.09.2023, 15:43
RE: script Lua, wiser for KNX - by admin - 13.09.2023, 07:49
RE: script Lua, wiser for KNX - by emmanuel.dassi - 22.09.2023, 12:44
RE: script Lua, wiser for KNX - by admin - 22.09.2023, 12:42
RE: script Lua, wiser for KNX - by admin - 22.09.2023, 12:46

Forum Jump: