Report this

What is the reason for this report?

How to Correctly Configure /etc/hosts for sendmail

Posted on 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 “sendmail@mydomain.com” 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:

127.0.0.1       mydomain.com localhost.localdomain localhost
127.0.1.1       localhost.mydomain.com mydomain.com

# 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 textbox defaults to using Markdown to format your 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 mandrillapp.com is pretty easy and free for 12k mails a month.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.