How to Configure ‘Zabbix Monitoring’ to Send Email Alerts to Gmail Account – Part 2

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Matei Cezar

I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

48 Responses

  1. Kevin Stretch says:

    Could not get the old command to work with Office365. Try this one instead (don’t forget to add the command line arguments in the Zabbix dashboard)

    /usr/bin/mail -s "$2" -r "HARDCODE_FROM_ADDRESS" "$1" <<< "$3"

  2. Sai says:

    Hey Hi,

    I have followed the procedure up to the allow access for less secure apps in my gmail account following your indications.But I am getting the error like this

    # echo “Body test email from ‘hostname -f’ “| mail -s “subject here” [email protected]
    O/P : mail: cannot send message: Process exited with a non-zero status

    can you please help me on this issue.

  3. Mahboob Ali says:


    I’m using Ubuntu and alertscript dir exists in /usr/lib/zabbix/alertscripts/. So I’ve make script file zabbix-sendmail in this location.

    I’ve using my other smtp server instead of Gmail which is working fine.

    I’ve completed step 3 and successfully able to send mail using /usr/lib/zabbix/alertscripts/zabbix-sendmail Mail-id “Subject” “Body” this command.

    Now there is issue in setp 4. I’ve configured media for sending mail and also enable action. But now triggers changed in zabbix GUI but it not able to send mail even no any logs are coming.

    So please suggest me what should I need to check ?

    • Matei Cezar says:

      Consult zabbix docs …the mail script parh has been changed.

      • Mahboob Ali says:

        I’ve check in /etc/zabbix/zabbix_server.conf file and in file alert location mention as below:


        It means script location is /usr/lib/zabbix/alertscripts and I’ve also create script in on same location but not get success.

  4. lucian says:

    alertscripts folder name and location is in zabbix_server.conf, where zabbix_server.conf is in /etc/zabbix default location for alertscripts in Ubuntu is /etc/zabbix/alert.d everything else worked, thanks

  5. Jose says:

    Hi, I follow the process up to allow access for less secure apps in my gmail account following your indications. However after apply changes and confirme it is turned on. I still receive the error ail: cannot send message: Process exited with a non-zero status.

    Any Idea about what could be the problem?

    thanks in advance.

  6. Ted Miller says:

    I found one thing missing: on Centos 7, ssmtp does not automatically activate itself as default mta when installed. I had to do command:

    # alternatives --config mta

    and then choose the number next to ssmtp. Before that postfix was grabbing my emails, so they weren’t being routed through gmail.

  7. nokiamben says:

    Hi, thank you!

    It works perfectly for me ^^

  8. Muli says:


    I followed all the guides regarding sending mail using Gmail,

    I manage to send test mails via script to Gmail accounts, but through zabbix mails are stuck in “in progress, 3 retries left” status.

    Any help would be appreciated.


Leave a Reply to Kevin Stretch Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.