Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How to perfectly configure zabbix gmail notification with postfix(relay to gmail) Actually this setup is working on my local machine but when I try to implement this on my real servers, email notification is failed and I could see the following error in Administration>audit>actions

Cannot connect to SMTP server [localhost] [gethost() failed for address 'localhost' [Success]]

my "/var/log/mail.log" message

Aug 26 00:14:31 station1 postfix/smtpd[9385]: connect from localhost.localdomain[]
Aug 26 00:14:31 station1 postfix/smtpd[9385]: disconnect from localhost.localdomain[]
Aug 26 00:15:31 station1 postfix/smtpd[9385]: connect from localhost.localdomain[]
Aug 26 00:15:31 station1 postfix/smtpd[9385]: disconnect from localhost.localdomain[]

I Checked my postfix gmail relay configuration with the telnet command as the folowing and connecting to smtp port 25

telnet localhost 25

And I could even send mail from terminal like

mail -s "Test mail"

The following are my media settings and this is the same settings which is working on my local machine

Type E-mail

SMTP server: localhost
SMTP helo: localhost
SMTP email: zabbix@localhost

Here are my settings.

/etc/hosts: localhost.localdomain localhost
<my-ip-here> station1


# Default:
# Server=


### Option: Hostname
# Unique, case sensitive hostname.
# Required for active checks and must match hostname as configured on the server.
# Default:
# Hostname=system.uname

Hostname=Zabbix server

### Option: ListenPort
# Agent will listen on this port for connections from the server.
# Mandatory: no
# Range: 1024-32767
# Default:
# ListenPort=10050


# This is a config file for zabbix_agent
# To get more information about Zabbix visit

### Option: Server
# IP address of Zabbix server
# Connections from other hosts will be denied
# If IPv6 support is enabled then '', '::', '::ffff:' are treated equally.
# Mandatory: yes
# Default:
# Server=


### Option: Timeout
# Spend no more than Timeout seconds on processing
# Mandatory: no
# Range: 1-30
# Default:
# Timeout=3



The only difference between my real server and my local machine is the hostname.

I even tried changing my media settings to my server domain name and hostname but no use.

Please need help!.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

try configuring e-mail server in zabbix media type configuration as, not localhost. if localhost resolves to ::1 and zabbix_server is compiled without ipv6 support, that may fail.

share|improve this answer
Oh my god! I don't know how do I appreciate you. I'm trying this for months. After changing localhost to loopback address, the mail just went off. Thanks Richiv!. – user53864 Sep 16 '10 at 0:40 Change the login password in the script, stick in the /usr/lib/zabbix/alertscripts, add the full name of the script (extension) in the method of notification to + users.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.