Ad Widget

Collapse

sendEmail script truncating message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmartiez
    Junior Member
    • Oct 2011
    • 4

    #1

    sendEmail script truncating message

    I am running the sendEmail script to send email alerts. The script works but the message body is all one line. Has anyone figured out how to enable this to multiline.

    Here is my script:

    #!/bin/sh


    export zabbixemailto="$1"
    export zabbixsubject="$2"
    export zabbixbody="$3"



    /usr/bin/sendEmail -f [email protected] -s smtpout.mydomain.com -xu [email protected] -xp password -t $zabbixemailto -u $zabbixsubject -m $zabbixbody
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2


    especially the "When in doubt, always double-quote your parameter expansions." part.

    you are not quoting the variables passed to sendEmail. i'm surprised it works at all
    Zabbix 3.0 Network Monitoring book

    Comment

    • jmartiez
      Junior Member
      • Oct 2011
      • 4

      #3
      I am a fairly noob on linux. I found out if I have put single or double quotes on the other variables, it doesn't work. I have figured out the original issue though. If I put \n in the action it will give me the new line. Thanks

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        well, variable expansion doesn't happen in single quotes, so that's out right there

        you also don't have to do 'export' in the script.

        in this case you could try something much more simple :

        Code:
        /usr/bin/sendEmail -f [email protected] -s smtpout.mydomain.com -xu [email protected] -xp password -t "$1" -u "$2" -m "$3"
        Zabbix 3.0 Network Monitoring book

        Comment

        • eduardobertobr
          Member
          • Jul 2014
          • 30

          #5
          This solved my problem!

          Originally posted by richlv
          well, variable expansion doesn't happen in single quotes, so that's out right there

          you also don't have to do 'export' in the script.

          in this case you could try something much more simple :

          Code:
          /usr/bin/sendEmail -f [email protected] -s smtpout.mydomain.com -xu [email protected] -xp password -t "$1" -u "$2" -m "$3"
          Tnk u! This helped me a lot!

          Comment

          • new2zabbixd
            Junior Member
            • Dec 2014
            • 3

            #6
            Hi,

            I need help in sending mail to my organization domain. We are successful in sending mail to gmail. Please note below setup details.

            Server Details:
            a. Ubuntu (Ver :14.04)
            b. Zabbix Server ( Ver : 2.2.7)
            c. Zabbix Agent (Ver :2.2)
            d. Mail client: SendMail

            I really appreciate if anyone can guide on this.

            Comment

            Working...