postfix issue

i think i posted that one in the wrong section

Hmm, what do you mean by "changes incoming emails to name@localhost"?

What is changed specifically, and what are you using to to view that? Are you using Usermin? Outlook?

Do you think you could post the full headers from an email where this occurs?


for example ive got an email
when it gets into postfix the email address suddenly becomes mbcis@whateverthehostnameis which is set to localhost so of course the email bounces because that email doesnt exist

Final-Recipient: rfc822;mbcis@localhost
Action: delayed
Status: 4.4.1
Remote-MTA: localhost
Diagnostic-Code: SMTP; Cannot connect to remote host

Content-Type: text/rfc822-headers

Received: from localhost ([])
for mbcis@localhost;
Mon, 30 Mar 2009 02:29:21 -0700
Received: from ( [])
by localhost (Postfix) with ESMTP id 1CF1313C64E
for <>; Mon, 30 Mar 2009 02:29:06 -0700 (PDT)
Received: by with SMTP id j37so1197837waf.9
for <>; Mon, 30 Mar 2009 02:29:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=gamma;
DomainKey-Signature: a=rsa-sha1; c=nofws;; s=gamma;
MIME-Version: 1.0
Received: by with SMTP id o10mr1968785waa.33.1238405344432; Mon,
30 Mar 2009 02:29:04 -0700 (PDT)
Date: Mon, 30 Mar 2009 22:29:01 +1300
Message-ID: <>
Subject: test
From: Shane Langley <>
Content-Type: multipart/alternative; boundary=00163646cbf2a49183046652b6e4


Your hostname is set incorrectly. Fix it. :wink:

thanks for that… what should i be setting it to? as i want it to recieve more than just 1 domain

You should set it to the hostname you want for the system. Receiving mail for multiple domains is irrelevant; that’s handled by the virtual map file (which Virtualmin manages automatically). “localhost” and similar is nonsensical for a public IP. The hostname returned by “hostname -f” needs to be a resolvable fully qualified domain name.

i had this set to before i changed it to localhost and every email that came in addressed to would get changed to

i just set the hostname for postfix to which points to that ip and it changes the email to


What happens if you log into your server over SSH, and you type this:

cat /etc/fstab | mail -s "A Fun Test"

What I’d like to see is the email logs from that time (/var/log/mail.log or /var/log/maillog), as well as the full email contents (including the headers).

i just set the hostname for postfix

What do you mean “for postfix”? I meant set your system hostname correctly! Don’t set anything in Postfix. Postfix is not responsible for your system hostname. I’m betting you’ve set “myorigin”, which is never the right thing to do in a virtual hosting environment. Remove that completely from your postfix configuration. You don’t want it, you don’t need it, and it doesn’t do what you think it does (it does what you’ve seen: causes mail to no be delivered because no one ever configures it correctly).

andrey when i do that i get mail: command not found

Joe: no its setting the hostname option, i took out the myorigin option a few days ago…
the system hostname is already set correctly

Okay, so lets try this:

  1. First, install the mailx package, using either apt or yum, and then try this again: cat /etc/fstab | mail -s "A Fun Test"

  2. What is the output of: hostname

  3. What are the contents of your /etc/hosts file

  4. Can you attach your /etc/postfix/ file?

You may have set the hostname, but something still isn’t working right, as the email headers are identifying your Internet facing IP address as “localhost”. Hopefully we’ll discover why that is in the above information :slight_smile:

does anyone have any idea? this is so weird

It’s not that weird. :wink:

Unset myhostname, and mydomain, and set mydestination back to something normal.

Mine is:

mydestination = $myhostname, localhost.$mydomain, localhost

After you’ve cleaned that stuff up, confirm that “hostname -f” actually returns a fully qualified and resolvable domain name. Don’t try to force Postfix to think your system is something other than what it actually is. Actually make your system be what you want it to be, and all of this “weird” behavior will go away.

have made those changes, still does the same thing
the following is in the mail.log file not sure if it makes a differnece or not?

Apr 1 19:26:41 59509 postfix/master[9516]: reload configuration /etc/postfix
Apr 1 19:26:44 59509 postfix/postfix-script: warning: /var/spool/postfix/etc/hosts and /etc/hosts differ
Apr 1 19:26:44 59509 postfix/postfix-script: warning: /var/spool/postfix/etc/nsswitch.conf and /etc/nsswitch.conf differ
Apr 1 19:26:54 59509 postfix/smtpd[10092]: connect from[]
Apr 1 19:26:55 59509 postfix/smtpd[10092]: 54D0B13C667:[]
Apr 1 19:26:55 59509 postfix/cleanup[10097]: 54D0B13C667: message-id=<>
Apr 1 19:26:55 59509 postfix/qmgr[10012]: 54D0B13C667: from=<>, size=10890, nrcpt=1 (queue active)
Apr 1 19:26:56 59509 postfix/smtpd[10092]: disconnect from[]
Apr 1 19:27:32 59509 postfix/postfix-script: warning: /var/spool/postfix/etc/hosts and /etc/hosts differ
Apr 1 19:27:33 59509 postfix/postfix-script: warning: /var/spool/postfix/etc/nsswitch.conf and /etc/nsswitch.conf differ

and a little bit more

Apr 1 19:28:05 59509 postfix/pickup[10011]: 1B5383E4005: uid=0 from=<root>
Apr 1 19:28:05 59509 postfix/cleanup[10097]: 1B5383E4005: message-id=<>
Apr 1 19:28:05 59509 postfix/qmgr[10012]: 1B5383E4005: from=<>, size=552, nrcpt=1 (queue active)
Apr 1 19:28:36 59509 postfix/local[10239]: 1B5383E4005: to=<>, orig_to=<root>, relay=local, delay=31, delays=0.03/0.01/0/31, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Apr 1 19:28:36 59509 postfix/qmgr[10012]: 1B5383E4005: removed

Oh, you’re chrooted, as well. Egads. :wink:

What OS are you running? I’m trying to figure out if I should yell at you or not. Some systems chroot by default, though the author of Postfix recommends against it. :wink:

But, anyway, either mail is not being deliver correctly, or you’ve missed the log entries we need to see. This is a successful delivery:

Apr 1 19:28:36 59509 postfix/local[10239]: 1B5383E4005: to=<>, orig_to=<root>, relay=local, delay=31, delays=0.03/0.01/0/31, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)

And I don’t see any other deliveries, successful or otherwise in either of these posts.

Restarting Postfix should repair the mismatched chroot stuff, I think, assuming the chrooted Postfix is part of the OS. And, yes, a mismatched chroot, especially /etc/hosts, is a very bad thing. :wink:

Oh, and when I say, "successful delivery", I mean "as successful as Postfix can do…it is being handed off the procmail, which may or may not put it in the right place, but once we have Postfix handing it off to procmail, Postfix is working and should no longer be messed with."

its running debian,
dont yell :stuck_out_tongue: i turned something off when i first set this up because it wouldnt send anything from the machine out im pretty sure that was chroot but mabye not
and the email is still sitting in the mail queue even though it says it sent there?

And my typo made this sentence nonsensical: “But, anyway, either mail is not being deliver correctly or you’ve missed the log entries we need to see.”

That should be "is NOW being delivered correctly".