Mail is received as "from:user@localhost.localdomain"

When I send mail through the sendmail command, I either get rejected:
host xxxx[—2] said: 450 4.1.8 dauntless@localhost.localdomain: Sender address rejected: Domain not found (in reply to RCPT TO command) (it actually says “localhost.localdomain”, which is the problem)

Or I receive an email (different target email) where I can see that the email is being sent from “dauntless@localhost.localdomain”.

Where can I change “localhost.localdomain” to my actual domain?

Also, I’ve only recently noticed the fact that mails weren’t being sent from my server and I’m wondering if any mails have been discarded because of this. Is there somewhere I can check this? (In logs somewhere?)



What Linux distro are you using?

And what is the output of the command “hostname”?

Lastly, do you know if you’re using the default MTA, Postfix?



It’s Ubuntu 10.04.4 LTS

dauntless:~$ hostname
(xxx = my ip address)

The content of /etc/hosts is localhost.localdomain localhost

Auto-generated hostname. Please do not remove this comment. lvpsxx-xxx-xx-xx

As far as I know I’m using postfix. The emails that get refused are shown in the message queue for postfix in webmin. (But I don’t know if they automatically get deleted after a while, and there’s only one test email in the queue right now from running “sendmail < test.mail”)


Hmm, that actually all looks pretty good.

Can you post the output of the command “postconf -n”?

Also, you asked about determining what’s been delivered/discarded… on Ubuntu, you can determine that by reviewing the mail logs in /var/log/mail.log, and the procmail log in /var/log/procmail.log.



Side note: I have a different domain than the one through my server ( But since it still displays localhost.localdomain, I guess that doesn’t matter much at this point.

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
mydestination = localhost.localdomain,,, localhost
myhostname =
mynetworks = [::ffff:]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
sender_bcc_maps = hash:/etc/postfix/bcc
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated rejec t_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_security_options = noanonymous
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = hash:/etc/postfix/virtual
I’ve modified my ip in mydestination and my domain name in myhostname (it correctly displays the domain name that is linked to my server and that I want as my email address)

What’s in the file “/etc/mailname”?


Bingo, that file contains “localhost.localdomain”. Should I just change this to my domain?

And thanks for your help, even though this doesn’t really seem to have anything to do with virtualmin.

I modified it and everything appears to be working :). Thanks again

Super, I’m glad that worked!

Another alternative is just to comment out the “myorigin” line in your /etc/postfix/

It should then take your hostname as the default name to use in email messages.


Hi Eric,

Something’s still going wrong. I got an email from my wordpress blog, but gmail marked it as SPAM. The headers still contain localhost.localdomain references:
Received: by with SMTP id ko4csp20280pbc;
Wed, 15 May 2013 08:11:26 -0700 (PDT)
X-Received: by with SMTP id i12mr10552274bkk.105.1368630685465;
Wed, 15 May 2013 08:11:25 -0700 (PDT)
Return-Path: dauntless@localhost.localdomain
Received: from ( [xx.xx.xx.xx])
by with ESMTP id zh10si689414bkb.111.2013.
Wed, 15 May 2013 08:11:23 -0700 (PDT)
Received-SPF: neutral ( xx.xx.xx.xx is neither permitted nor denied by best guess record for domain of dauntless@localhost.localdomain) client-ip=xx.xx.xx.xx;
spf=neutral ( xx.xx.xx.xx is neither permitted nor denied by best guess record for domain of dauntless@localhost.localdomain) smtp.mail=dauntless@localhost.localdomain
Received: by (Postfix, from userid 1004)
id 1E6B811320006; Wed, 15 May 2013 17:11:21 +0200 (CEST)
Subject: [] Comment: “-----”
X-PHP-Originating-Script: 1004:class-phpmailer.php
Date: Wed, 15 May 2013 15:11:21 +0000
From: Martin
X-Priority: 3
X-Mailer: PHPMailer 5.2.1 (
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=“UTF-8”
(I’ve removed my ip address and shortened my domain name)