Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've got monit running on a server to alert by email with the following config

set mailserver
 using hostname "vps1.sender.com"

set mail-format { from: monit@sender.com }

set alert webmaster@receiver.com

but the mails are still coming through with a hostname of localhost

 Aug  7 08:40:55 mx1 postfix/smtpd[31060]: NOQUEUE: reject: RCPT from
 vps1.sender.com[xx.xx.xx.xx]: 504 5.5.2 <localhost>: Helo command
 rejected: need fully-qualified hostname; from=<monit@sender.com>
 to=<webmaster@receiver.com> proto=ESMTP helo=<localhost>

It's the only config file I have.

What am I missing?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

The problem was a configuration issue with postfix.

Make sure the myhostname= variable is set correctly in /etc/postfix/main.cf. Apparently monit cant override that setting.

share|improve this answer

Monit uses /etc/hostname and /etc/hosts files for fqdn. If you did not setup those files, hostname file includes localhost line by default. You must change this to your fqdn and set yourIP fqdn in /etc/hosts file.

share|improve this answer
Both are set to vps1.sender.com –  Christian Aug 7 '13 at 9:18
Does you subdomain registered in any DNS server? Or just named in server hosts file? –  Sencer H. Aug 7 '13 at 9:21
Maybe we both looking wrong place! What if problem caused by mail service? While I read second time it dawned on me. <localhost> is printed in mail log. I think you must check your mail service configuration. –  Sencer H. Aug 7 '13 at 9:37
I KNOW WHAT IT IS!! In postfix main.cf, it had myhostname=localhost how annoying! Thanks for your time though. –  Christian Aug 7 '13 at 9:38
You're welcome. –  Sencer H. Aug 7 '13 at 9:41

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.