Email Settings

Discussion in 'C-Bus Automation Controllers' started by Ambro, Feb 4, 2018.

  1. Ambro

    Ambro

    Joined:
    Nov 23, 2010
    Messages:
    104
    Likes Received:
    1
    Location:
    Adelaide
    Would anybody know what the settings for the "secure" protocol is for a basic non-secure SMTP port 25 account would be? (Trying to replicate what is in a CTC to the SHAC - a basic user account for the ISP 'internode' is currently used where their smtp server is 'mail.internode.on.net', port 25, user details are the account holders loggin details. Trying port 465 and "sslv23" does not work.)

    Also, when using gmail to send notifications via the SHAC script the "from" field does nothing. Is this a gmail restriction not being able to set a different 'from' address?
     
    Ambro, Feb 4, 2018
    #1
  2. Ambro

    jboer

    Joined:
    Apr 27, 2012
    Messages:
    458
    Likes Received:
    35
    Location:
    Sydney
    Hey, I dont know about the first question, but with the second, most major ISPs wont allow you to 'spoof' a different 'from' address when sending from an account, it is a common spam and phishing tactic so they lock the 'from' account to be the actual account.
     
    jboer, Feb 4, 2018
    #2
    Ambro likes this.
  3. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    Anyone else having email issues with SHAC
    anybody any idea on port numbers and secure protocol for Telstra account
    Used same as setup with wiser2 (which works ok) but no emails sent
    Thanks
     
    magic8, Dec 2, 2018
    #3
  4. Ambro

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    322
    Likes Received:
    5
    Location:
    FNQ
    Hi Ambro.

    Don't know if the following will work for you, but I had a similar problem where the "from" field in the "local settings" didn't work for my GMX email account. I changed it to the following and it hasn't missed a beat. You may just have to add the line of code "from= " in the "messages headers and body" section to your set up. Let us know how you go :)

    Code:
    --gmx.com
    function mail(to, subject, message)
      local settings = {
        -- "from" field, only e-mail must be specified here
        from = '[email protected]',
        -- smtp username
        user = '[email protected]',
        -- smtp password
        password = 'your_password',
        -- smtp server
        server = 'mail.gmx.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 = {
          from = '[email protected]', --Added this line for gmx.com mail notifications
          to = table.concat(to, ', '),
          subject = subject,
          ['Content-type'] = 'text/html; charset=utf-8',
        },
        body = message
      })
      settings.rcpt = to
      return smtp.send(settings)
    end
    
     
    Mr Mark, Dec 3, 2018
    #4
  5. Ambro

    Ambro

    Joined:
    Nov 23, 2010
    Messages:
    104
    Likes Received:
    1
    Location:
    Adelaide
    Thanks Mr Mark; I resorted in leaving it as a gmail sent email rather than trying to get it to run off the ISP email server. FYI I did try the from field and it had no results. I can confirm it does work with gmail so I just create a new "cbus" email address for the SHAC and keep moving on with life...!
     
    Ambro, Dec 6, 2018
    #5
    Mr Mark likes this.
  6. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    Still having email issues with SHAC
    Have followed instructions i think but still cannot get SHAC to send emails
    Same account details worked ok with wiser 2
    Edited the email common functions with my email details (telstra) and made a simple script that if a light comes on send email using the helper email function and edited lines 2,3 and 4.
    This is the error

    user-library 30.01.2019 08:34:26
    User library TEST:4: attempt to call global 'rscalc' (a nil value)
    stack traceback:
    User library TEST:4: in main chunk
    [C]: in function 'require'
    Library user-autoload:1: in main chunk

    Any help appreciated
    Am sure I have done something stupid!!!!!!!
    Thanks
     
    magic8, Jan 29, 2019
    #6
  7. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    Sorry
    That error was to do with a script in user library
    Script deleted and no errors but still no email sent!!!!
     
    magic8, Jan 31, 2019
    #7
  8. Ambro

    Josh

    Joined:
    Aug 25, 2004
    Messages:
    240
    Likes Received:
    0
    Location:
    Pretoria, South Africa
    I have not been able to send emails (using Gmail) either.
     
    Josh, Jan 31, 2019
    #8
  9. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    I tried sending emails using my Telstra account using many different ports and still no good
    Also tried from my google account with no success
    Will try and ring technical support next week as I think I have tried everything
    Thanks
     
    magic8, Jan 31, 2019
    #9
  10. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    These are the latest settings and script i have tried and still no emails sent

    image1.jpeg IMG_4143.JPG
     
    magic8, Feb 3, 2019
    #10
  11. Ambro

    jboer

    Joined:
    Apr 27, 2012
    Messages:
    458
    Likes Received:
    35
    Location:
    Sydney
    This might be a dumb question but have you tried pinging smtp.telstra.com from the SHACs ping utility? Just make sure you can actually hit it from the SHAC?
     
    jboer, Feb 4, 2019
    #11
  12. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    BB0DCEC0-E5CF-4A95-8B63-72F36D67840B.jpeg Does this mean cannot use Telstra or is there another problem
    Thanks for reply
     
    magic8, Feb 4, 2019
    #12
  13. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    Using same utility pinging gmail.com came back ok
    No packet loss!!
     
    magic8, Feb 4, 2019
    #13
  14. Ambro

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,524
    Likes Received:
    173
    Location:
    Adelaide, Australia
    Telstra doesn't allow pinging any of their mail servers. No idea why.

    I've never got the SHAC to send e-mails either. I even tried setting up my own mail server and couldn't get that to work.
     
    Ashley, Feb 5, 2019
    #14
  15. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    Are we saying that the shac can’t send emails
    It has been useful for clients in the past with wiser2
    Should the instructions and commands be removed?
    Is it official that if the clients want to send emails when events occur we tell them to go with wiser2?
    I was under the impression that the shac was the way forward
    Thanks for info
     
    magic8, Feb 5, 2019
    #15
  16. Ambro

    jboer

    Joined:
    Apr 27, 2012
    Messages:
    458
    Likes Received:
    35
    Location:
    Sydney
    From the above it looks like Ambro and Mr Mark got it working? It might have been broken in a firmware update, what firmware are you currently running? Something that seems to be an issue with the SHAC is after editing those resident and ect scripts is they don't actually take the settings until you disable and then re-enable the script?
     
    jboer, Feb 5, 2019
    #16
  17. Ambro

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,524
    Likes Received:
    173
    Location:
    Adelaide, Australia
    So I thought I'd give this another go since I haven't tried it for months and it worked just fine! I'm currently running V1.6.0

    Here are my settings:

    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 = '[email protected]',
        -- smtp username
        user = '[email protected]',
        -- smtp password
        password = 'xxxxxxxxxx',
        -- smtp server
        server = 'smtp.telstra.com',
        -- smtp server port
        port = 465,
        -- enable ssl, required for gmail smtp
        secure = 'sslv23',
      }
    
    And to run it:

    Code:
    subject = 'E-mail test'
    message = 'Testing e-mail'
    mail('[email protected]', subject, message)
    It works fine for other destination addresses to.
     
    Ashley, Feb 5, 2019
    #17
    jboer likes this.
  18. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    At least good to know shac is capable of emailing
    Will try mine again later and see if I can get to work
    It seems I am not the only one who can’t get it to work so maybe there is a trick to it.
     
    magic8, Feb 5, 2019
    #18
  19. Ambro

    magic8

    Joined:
    Jan 6, 2009
    Messages:
    97
    Likes Received:
    1
    AT LAST!!!!!!!
    Got an email sent from my gmail account so am sure all will be good now
    For some reason I think that email common function script was incorrect some how, probably me
    I copied and pasted it from another shac and now perfect
    Thanks everyone for the help
     
    magic8, Feb 6, 2019
    #19
    jboer likes this.
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.