Answered: Two issues with postfix - sendto rewrites and time


I am so close to going live with my VP site (and dropping my current service provider, though well-intentioned, cannot keep their SMTP server off of various blacklists) that I can almost taste it. I seem to have one ‘major’ issue and one minor one.

The major issue:
I configured an email account within MS Outlook to use the new server for POP and SMTP. Since the DNS records have not yet been moved, I simply used the IP address. I clicked the button ‘Test Account Settings’ and everything seemed to proceed normally, however, I never received the test message.

When I checked out /var/log/maillog, I found the reason: postfix (I assume) rewrote the send-to address from user@mydomain to user-mydomain@mydomain. Under virtualmin->Edit Users, I see user@mydomain and under webmin->System->Users and Groups I see both user@mydomain and user-mydomain, however, the two ‘users’ are the same as the User ID is the same. (My system is configured such that when user@mydomain is created from virtualmin, that both user@mydomain and user-mydomain are created under webmin.)

I need to ensure that this rewrite does not happen. My guess is that I am one simple setting from resolving this problem, but I do not know where to look. Please help.

Regarding the minor problem: I noticed that the time reported in /var/log/maillog is wrong. This is a virtual server and I know that I cannot change the actual clock. However, I did the following:
ln -sf /usr/share/zoneinfo/EST localtime
and after doing this, the date command and the webserver both report the proper time. However, the time reported in maillog is off by two hours. Any suggestions for how this can be fixed?


Hmm, so in the scenario you’re describing – where is the email going? Is it being delivered somewhere? Or is it bouncing?



In all honesty, I have no idea. Since I do not have a catch-all defined, it was never received; and no bounce was returned.

I just tried again, sending a test email to user@mydomain.tld via the VPS. Following are the relevant maillog entries:

Nov 12 02:48:54 server postfix/smtpd[32577]: connect from[xx.xx.xx.xx] Nov 12 02:48:54 server postfix/smtpd[32577]: E9CC053C100F:[xx.xx.xx.xx], sasl_method=LOGIN, sasl_username=user@mydomain.tld Nov 12 02:48:55 server postfix/cleanup[32581]: E9CC053C100F: message-id=<020101cedf38$96a9dc00$c3fd9400$@mydomain.tld> Nov 12 02:48:55 server postfix/qmgr[13543]: E9CC053C100F: from=, size=4025, nrcpt=1 (queue active) Nov 12 02:48:55 server postfix/error[32582]: E9CC053C100F: to=, orig_to=, relay=none, delay=0.17, delays=0.11/0.03/0/0.03, dsn=5.0.0, status=bounced (User unknown in virtual alias table) Nov 12 02:48:55 server postfix/cleanup[32581]: 1788553C1F95: message-id=<20131111234855.1788553C1F95@server.mydomain.tld> Nov 12 02:48:55 server postfix/qmgr[13543]: 1788553C1F95: from=<>, size=5962, nrcpt=1 (queue active) Nov 12 02:48:55 server postfix/bounce[32583]: E9CC053C100F: sender non-delivery notification: 1788553C1F95 Nov 12 02:48:55 server postfix/qmgr[13543]: E9CC053C100F: removed Nov 12 02:48:55 server postfix/error[32582]: 1788553C1F95: to=, orig_to=, relay=none, delay=0, delays=0/0/0/0, dsn=5.0.0, status=bounced (User unknown in virtual alias table) Nov 12 02:48:55 server postfix/qmgr[13543]: 1788553C1F95: removed Nov 12 02:48:57 server postfix/smtpd[32577]: disconnect from[xx.xx.xx.xx]

Ah, I think I might understand the issue now… if you run the command “hostname”, what shows up – is it a domain in the format “domain.tld”, and not an FQDN such as “host.domain.tld”?


Sounds like you have an idea!

I telnet’ed to the server and typed hostname. The response was server.mydomain.tld.

server.mydomain.tld is the name I assigned to the virtualmin ‘server’. I created mydomain.tld as a virtual server.


Someone - please show some mercy and help. I am completely dead in the water until this issue is resolved.

It is actually correct that Postfix rewrites the destination as user-domain@serverdomain. This is how Virtualmin configures Postfix’ virtual domain table.

I can’t say exactly what’s wrong in your setup, but a correct setup should be like follows.

The rewriting line should look like so:

Nov 20 09:46:32 australis postfix/local[15220]: A54BA40913: to=<>, orig_to=<>, relay=local, delay=3.4, delays=0.4/0/0/3, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -a "$EXTENSION" -d $LOGNAME)

Make sure your /etc/mailname contains the server’s FQDN (which should be of the form “host.domain.tld”) and that /etc/postfix/ contains these lines:

myhostname = alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases virtual_alias_maps = hash:/etc/postfix/virtual myorigin = /etc/mailname mydestination =,, , localhost

Also make sure that Webmin -> Servers -> Postfix -> Virtual Domains has the setting "Domain mapping lookup table: Map specification hash:/etc/postfix/virtual" and the map list below contains all your email addresses, in the form “Name: MAPS TO”.


Thank you for the detailed reply.

Starting from the bottom of your message:

  • Domain mapping table is defined
  • map contains all email addresses

The problem may be this - I could not find /etc/mailname. I looked in the directory /etc and also tried using locate, but nothing was found.

I examined /etc/postfix/ and found the following:

  • myhostname is not defined - it is commented out
  • alias_maps is defined properly
  • alias_database is defined properly
  • virtual_alias_maps is defined properly
  • myorigin is defined to be $mydomain and mydomain is not defined (commented out)
  • mydestination is defined using myhostname and mydomain which are not defined

Given your notes, I am confident that I can update However, I do not know how to resolve the problem with /etc/mailname. Any suggestions?

One question for clarification: My virtualmin host has a FQDN of server.mydomain.tld and the one virtual server I am running is firstvps.mydomain.tld. In your notes above, is ‘serverhost’ server or firstvps?

Again, thank you.

The missing “mailname” file might be a distribution thing - what distro are you using?

You could always just try to adjust your to the values I listed (make a copy first), create the /etc/mailname file with your server’s FQDN as contents, and see if it works then.

My “serverhost” would be your server, not the first vps.

Thanks for the reply - I will try doing as you suggest.

I am using CentOS 6.4 (64 bit)


Thank you - it seems to work. I had to comment out the myorigin line, but I sent a test email and it was delivered.

Nice, glad you got it working! :slight_smile: