Ad Widget

Collapse

Error with UTF8 in emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maxlehot1234
    Junior Member
    • Nov 2018
    • 4

    #1

    Error with UTF8 in emails

    Hey everyone,

    I use an html template that support UTF8 in META, but when zabbix send the email for alerts, there is no UTF8 support.

    So I think it was something related to Zabbix.


    If anyone have an answer for this, let me know.


    Thanks again and have a nice day
  • Engraf
    Member
    • Sep 2014
    • 41

    #2
    Not sure what do you mean by "html template". If you are about Default message in action operations configuration then zabbix native smtp client doesn't support html format of the alert messages.
    For this purpose, you have to use an external program and Script media type.
    I'm using the nbsmtp.
    The idea is taken from here: https://www.zabbix.com/forum/zabbix-...ed-smtp-how-to
    My script
    Code:
    #!/bin/sh
    
    export [email protected]
    export zabbixmailto="$1"
    export zabbixsubject="$2"
    export zabbixbody="$3"
    export smtpserver=mail.mydomain.com
    export [email protected]
    export smtppass=zpassword
    export hellomsg=zabbix.mydomain.com
    
    {
    echo "From: \"Zabbix Server\" <$smtpmailfrom>"
    echo "To: $zabbixmailto"
    echo "Subject: ""$zabbixsubject"
    echo "MIME-Version: 1.0"
    [B]echo "Content-Type: text/html; charset=\"UTF-8\""[/B]
    echo ""
    echo "$zabbixbody"
    } | /usr/local/bin/nbsmtp -V -N -n -M c -S -d $hellomsg -f $smtpmailfrom -h $smtpserver -U $smtplogin -P $smtppass
    My Default message (with color indication of severity)
    Code:
    <style>
    div {  font: 12pt serif; }
    table { border: 0px; width: 100%; }
    table.severity0 { background-color: #dcdcdc; padding: 0.5px 3px; color: #000000; }
    table.severity1 { background-color: #80dfff; padding: 0.5px 3px; color: #00008b; }
    table.severity2 { background-color: #ffff4d; padding: 0.5px 3px; color: #0000ff; }
    table.severity3 { background-color: #ffb366; padding: 0.5px 3px; color: #000000; }
    table.severity4 { background-color: #e35835; padding: 0.5px 3px; color: #ffffff; }
    table.severity5 { background-color: #e01f1f; padding: 0.5px 3px; color: #ffff00; }
    </style>
     <table class="severity{EVENT.NSEVERITY}"><tr align="left"><td><b>{HOST.NAME}:</b> «{TRIGGER.NAME}»</td></tr></table>
    <br>
    <div><b>Item</b>: «{ITEM.NAME}» = <span style="color: red; font-weight: bold">{ITEM.VALUE} [{EVENT.STATUS}]</span></div>
    <div><b>Occurred at:</b> {EVENT.TIME} {EVENT.DATE}</div>
    <br>
    <div><b>Generated by Action</b>: «{ACTION.NAME}»</div>
    <div><b><a href="{$ZABBIX_SERVER_URL}/tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}">Details</a></b></div>
    Last edited by Engraf; 30-01-2019, 12:04.

    Comment

    • maxlehot1234
      Junior Member
      • Nov 2018
      • 4

      #3
      I use this script: https://github.com/dimuskin/ax-zabbix-html-template

      It allow me to have email in HTML.
      Utf8 works in the .html files, but when zabbix send emails, it send it like this:
      vient de redémarrer

      Instead of: vient de redémarrer

      I know it looks weird, I'm french

      Thanks for your reply

      Comment

      • maxlehot1234
        Junior Member
        • Nov 2018
        • 4

        #4
        And anyone?

        Comment

        Working...