Ad Widget

Collapse

Email notifications

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MichaelF
    Member
    • Feb 2019
    • 65

    #1

    Email notifications

    Hello!

    Would anyone please tell me why my email messages started looking as the single-line messages (body) instead of the default style?

    In fact I've selected the Custom message checkbox just to include hostname in the subject - then I put the same macros in the message body as in the default messages but now all words there are in one line... ???

    Thank you in advance,
    Michael
    Attached Files
  • Answer selected by MichaelF at 19-11-2025, 14:50.
    Andrejs Poddubņaks
    Junior Member
    • Nov 2025
    • 18

    Originally posted by BP_Vital
    Email(HTML) expects tags for formatting,
    is the one for line break.
    Take a look at Alerts -> Media types -> Email(HTML) -> Message templates for examples.
    In brief, this is the situation, just in addition to what BP_Vital said:
    1. You are using the media type “Email (HTML)”.
    2. When you set a custom message, Zabbix sends exactly the HTML you wrote.
    3. In HTML, line breaks \n are ignored, and everything is concatenated into a single line. In the default template, Zabbix adds <br> and <b>, so everything looks nice there.

    The soultions:
    1. Leave HTML and add tags:
    Problem started at {EVENT.TIME} on {EVENT.DATE}<br>
    Problem name: {TRIGGER.NAME}<br>
    Host: {HOST.NAME}<br>
    Severity: {EVENT.SEVERITY}<br>
    Operational data: {?last({HOST.HOST}/{ITEM.KEY})}<br>
    Original problem ID: {EVENT.ID}


    2. Use the text media type
    Create/select Email (text) and you can write your message as normal text line breaks will be preserved automatically.

    Comment

    • BP_Vital
      Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Feb 2016
      • 42

      #2
      Email(HTML) expects tags for formatting, <br> is the one for line break.
      Take a look at Alerts -> Media types -> Email(HTML) -> Message templates for examples.

      Comment

      • Andrejs Poddubņaks
        Junior Member
        • Nov 2025
        • 18

        #3
        Originally posted by BP_Vital
        Email(HTML) expects tags for formatting,
        is the one for line break.
        Take a look at Alerts -> Media types -> Email(HTML) -> Message templates for examples.
        In brief, this is the situation, just in addition to what BP_Vital said:
        1. You are using the media type “Email (HTML)”.
        2. When you set a custom message, Zabbix sends exactly the HTML you wrote.
        3. In HTML, line breaks \n are ignored, and everything is concatenated into a single line. In the default template, Zabbix adds <br> and <b>, so everything looks nice there.

        The soultions:
        1. Leave HTML and add tags:
        Problem started at {EVENT.TIME} on {EVENT.DATE}<br>
        Problem name: {TRIGGER.NAME}<br>
        Host: {HOST.NAME}<br>
        Severity: {EVENT.SEVERITY}<br>
        Operational data: {?last({HOST.HOST}/{ITEM.KEY})}<br>
        Original problem ID: {EVENT.ID}


        2. Use the text media type
        Create/select Email (text) and you can write your message as normal text line breaks will be preserved automatically.

        Comment

        • MichaelF
          Member
          • Feb 2019
          • 65

          #4
          Thank you all for your help!!!

          Regards,
          Michael Firsov

          Comment

          Working...