How to Correctly Configure /etc/hosts for sendmail

October 29, 2014 2.6k views

I'm trying to set up a sendmail instance on my droplet that will be able to forward any emails sent from my web app/website/terminal/etc over to my Google Apps account. I've followed this tutorial (with slight modifications) so my Gmail user "" will relay any emails sent from the web app to the gmail account.

Any time I try and test sendmail in this way, however, I get the error:

mail: cannot send message: Process exited with a non-zero status

I'm pretty sure this is because my /etc/hosts file is set up incorrectly; currently, it looks like this: localhost.localdomain localhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

What should be changed?

1 Answer

That looks too messy and can cause you problems as gmail has a limit of email send this way. try using is pretty easy and free for 12k mails a month.

Have another answer? Share your knowledge.