How do I get rid of localhost from email header?

Solution 1:

I doubt this is triggering spam filters. Its hard to say without more headers, but this is common for an application running on the same machine as the smtp server. The app is submitting the message through localhost.

But you can check /etc/hosts to ensure your host name is setup correctly. As well you can check your smtp server to ensure its using the proper host name.

Solution 2:

/etc/hosts

insert between 127.0.0.1 and other entries, the FQDN you want, aka wordswithfriends.net

The mail server picks up the first entry for 127.0.0.1 ( since that is the connection used ) that has a . in it, aka FQDN.

So if you have

127.0.0.1 wordswithfriends.net servername localhost localhost.localdomain

You will show. Received: from wordswithfriends.net (wordswithfriends.net [127.0.0.1])

But as Steven said, I also doubt it is triggering spam filters.