I have exactly the same problem as this. In a nutshell I am using mime::lite to send admin emails but they appear to be being flagged as spam because localhost[127.0.0.1] appears in the headers.
My question is how do I get rid of the references to localhost & 127.0.0.1 in the email headers?
The answer to the question linked to above was to install postfix, sadly this is already installed on the Fedora 14 host in question and it has not made any difference.
After the message has been set up this line is used to send the mails:
MIME::Lite->send("sendmail", "/usr/lib/sendmail -t -oi -oem -froot\@mail.mydomain.com");
I have tried various configurations within main.cf, myhostname is setup as 'mail.mydomain.com'. I tried explicitly setting 'myorigin = $myhostname' but, unsurprisingly as that is the default that did not make any difference.
In all the following examples and configs the real public IP address has been substituted with 220.127.116.11 and the domains as mydomain.com and mydomain1.com.
This is an example (edited) header with the offending bits in bold:
Return-path: <email@example.com> Received: from smtpin.myisp.com ([10.30.30.30]) by ms.myisp.com (ISP server details removed (built Aug 10 2011)) with ESMTP id <9XX8881234XX12X0@ms.myisp.com> for firstname.lastname@example.org; Thu, 13 Oct 2011 12:49:08 +0000 (GMT) Original-recipient: rfc822;email@example.com Received: from mail.mydomain.com ([18.104.22.168.111]) by smtpin.myisp.com (ISP server details removed (built Jan 31 2010)) with ESMTP id <7YY11111Y1YY1YY1@smtpin.myisp.com> for firstname.lastname@example.org (ORCPT email@example.com); Thu, 13 Oct 2011 05:49:08 -0700 (PDT) Received: from mail.mydomain.com (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.mydomain.com (Postfix) with ESMTPS id 6ZZ6Z6Z6666 for <firstname.lastname@example.org> Thu, 13 Oct 2011 12:49:02 +0000 (UTC) Received: (from root@localhost) by mail.mydomain.com (8.14.4/8.14.4/Submit)
This is the output from postconf -n:
alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases bounce_queue_lifetime = 1 broken_sasl_auth_clients = yes command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 home_mailbox = Maildir/ html_directory = no inet_interfaces = all inet_protocols = all local_recipient_maps = mail_owner = postfix mailbox_command = mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man maximal_queue_lifetime = 1 mydestination = mail.mydomain01.com, mail.mydomain.com myhostname = mail.mydomain.com mynetworks = 127.0.0.0/8 [::1]/128 myorigin = $myhostname newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.7.5/README_FILES sample_directory = /usr/share/doc/postfix-2.7.5/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtp_tls_note_starttls_offer = yes smtp_use_tls = yes smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_authenticated_header = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_path = private/auth smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem smtpd_tls_auth_only = no smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s smtpd_use_tls = yes tls_random_source = dev:/dev/urandom unknown_local_recipient_reject_code = 550
This the contents of /etc/hosts:
127.0.0.1 localhost localhost.localdomain
22.214.171.124 mail.mydomain.com main.mydomain1.com mail
I can't post headers from a mail that has actually been marked as spam as mail to my real address is no longer marked as spam because I set the 'not junk' flag for email from our server. AOL is one of the (test) destinations and it is not possible to display headers using the AOL web interface. Mail sent to a gmail address simply does not arrive, I guess the server is kindly preventing delivery.
I checked using http://www.mxtoolbox.com, results vary for no apparent reason but our server address appeared (then disappeared again) on two lists because 'return codes were 127.0.0.6', which is odd because that particular loopback address has never appeared in our emails, unless postfix is doing something really weird, which seems unlikely.
If any other config data is required please let me know.