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?)

Thanks!

Howdy,

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?

-Eric

Hi,

It’s Ubuntu 10.04.4 LTS

dauntless:~$ hostname
lvpsXX-XXX-XX-XX.dedicated.hosteurope.de
(xxx = my ip address)

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

Auto-generated hostname. Please do not remove this comment.

xx.xxx.xx.xx lvpsxx-xxx-xx-xx.dedicated.hosteurope.de 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 myemail@myhost.com < test.mail”)

Howdy,

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.

-Eric

Hi,

Side note: I have a different domain than the one through my server (vpsxxxx.hosteurope.de). 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, lvpsxxx.dedicated.hosteurope.de, localhost.dedicated.hosteurope.de, localhost
myhostname = correctdomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/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”?

-Eric

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.

–Edit–
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/main.cf.

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

-Eric

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:
Delivered-To: info@dl.be
Received: by 10.68.203.68 with SMTP id ko4csp20280pbc;
Wed, 15 May 2013 08:11:26 -0700 (PDT)
X-Received: by 10.204.78.12 with SMTP id i12mr10552274bkk.105.1368630685465;
Wed, 15 May 2013 08:11:25 -0700 (PDT)
Return-Path: dauntless@localhost.localdomain
Received: from dl.be (xxxxx.dedicated.hosteurope.de. [xx.xx.xx.xx])
by mx.google.com with ESMTP id zh10si689414bkb.111.2013.05.15.08.11.21
for info@dauntless.be;
Wed, 15 May 2013 08:11:23 -0700 (PDT)
Received-SPF: neutral (google.com: 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;
Authentication-Results: mx.google.com;
spf=neutral (google.com: 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 dl.be (Postfix, from userid 1004)
id 1E6B811320006; Wed, 15 May 2013 17:11:21 +0200 (CEST)
To: info@dl.be
Subject: [dl.be] Comment: “-----”
X-PHP-Originating-Script: 1004:class-phpmailer.php
Date: Wed, 15 May 2013 15:11:21 +0000
From: Martin wordpress@dl.be
Message-ID: c69fc82d40d40f7d403044fada47356e@www.dl.be
X-Priority: 3
X-Mailer: PHPMailer 5.2.1 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
Reply-To: XXXXXXXXXXXX
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)