SHAC email function -

Discussion in 'C-Bus Automation Controllers' started by philthedill, May 10, 2020.

  1. philthedill

    Pie Boy

    Joined:
    Nov 21, 2012
    Messages:
    248
    Likes Received:
    31
    Location:
    New Zealand
    In the common functions for the email function Change content-type header to
    ['Content-type'] = 'text/plain; charset=utf-8',

    Then format your message string like this
    mail('[email protected]' ,'Data', “one line\ntwo line\n\three line”)

    the header ['Content-type'] = 'text/html; charset=utf-8',
    ignores all spaces and new lines etc
     
    Last edited: May 22, 2020
    Pie Boy, May 22, 2020
    #21
    philthedill likes this.
  2. philthedill

    philthedill

    Joined:
    Mar 21, 2010
    Messages:
    140
    Likes Received:
    3
    Location:
    Melbourne
    thanks Pie Boy - that worked a treat
    and thank you to everyone else that helped me solve this.
     
    philthedill, May 22, 2020
    #22
  3. philthedill

    Pie Boy

    Joined:
    Nov 21, 2012
    Messages:
    248
    Likes Received:
    31
    Location:
    New Zealand
    Also after some more looking into it, if you use the header
    ['Content-type'] = 'text/html; charset=utf-8' as it is in the original function without modifying the header,
    you can just use html encoding inside a string to get the new line with<BR>

    msg = "one line<BR>next line<BR>line 3 <BR>"

    mail('[email protected]', 'subject', msg)
     
    Pie Boy, May 27, 2020
    #23
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.