How to Correctly Configure /etc/hosts for sendmail

  • Posted October 29, 2014

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?


This comment has been deleted

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.