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.

mail function does not work for me
#1
Hello, I am trying to use the mail function, but it doesn't work for me.

This is the function setting:


function mail(to, subject, message)
  -- make sure these settings are correct
  local settings = {
    -- "from" field, only e-mail must be specified here
    from = 'LM-ANA@x-domotica.com',
    -- smtp username
    user = 'LM-ANA@x-domotica.com',
    -- smtp password
    password = '................',
    -- smtp server
    server = 'mail.x-domotica.com',
    -- smtp server port
    port = 587,
    -- enable tls, required for gmail smtp
    secure = 'none',
    starttls = false,
  }


Nor does it record anything in Log.

The only message I have is in the error log and it says:

Library socket / tp: 0: attempt to index a nil value
stack traceback:
  [C]: in function 'mail'
  User script: 8: in main chunk


Why dont work?

Thanks very much for your help.
Reply
#2
Port 587 usually requires starttls mode. Have you tried enabling it? Keep in mind that starttls might not work on older firmware versions.
Reply
#3
I have tested this Mozilla Thunderbird account setup and it works without STARTTLS on port 587, so I have added STARTTLS = "false" to it.

I have tried putting STARTTLS = "true" and it doesn't work for me either.

If I put STARTTLS = true

In the LOG the message appears:

* arg: 1
  * nil
* arg: 2
  * string: invalid protocol (none)

The secure variable inside settings, what parameters can it have?

For google it is: secure = 'tlsv1_2'

But what other options does this variable have?

I have changed the secure = 'tlsv1_2' variable

Now in the Log appears:

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

RESOLVED.

I have configured it with:


port = 587,
    -- enable tls, required for gmail smtp
    secure = 'tlsv1_2',
    starttls = true,
  }


Thank you.
Reply


Forum Jump: