Postfix changes resolved alias from good [user@domain.tld] to bad [user.domain@domain.tld]

I have a domain that has mail processed on a different server than the webserver.

For processing mail I have set up a separate CentOS 5 Virtualmin GPL box. The domain is setup with no webserver features, all mail features.

Users have been set up. "User-1" is shown with email address as user-1@domain.tld and login as user-1.domain.

User has set up an alias of newsletter-1@domain.tld, this shows in the Edit Mailbox > Email Settings >
Additional email addresses as newsletter-1@domain.tld. In Virtualmin > Edit Mail Aliases the name shows as newsletter-1 with an Alias Destination of user-1@domain.tld

Incoming mail sent to an invalid address gets bounced ok.

When mail is sent either to user-1@domain.tld or to newsletter-1@domain.tld, the destination address is changed to user-1.domain@domain.tld and delivery fails.

Mail to user-1@domain.tld has log entries like this

Jan 25 10:07:51 mail postfix/smtpd[28288]: AAE0D510088: client=unknown[189.7.204.55]
Jan 25 10:07:52 mail postfix/cleanup[28291]: AAE0D510088: message-id=<20110125180751.AAE0D510088@mail.domain.com>
Jan 25 10:07:52 mail postfix/qmgr[27819]: AAE0D510088: from=, size=1100, nrcpt=1 (queue active)
Jan 25 10:07:52 mail postfix/error[28292]: AAE0D510088: to=, orig_to=,

Mail to newsletter-1@domain.tld has log entries like this

Jan 25 10:36:29 mail postfix/smtpd[28988]: 37B8951012C: client=mail.senderhost2.com[207.115.94.73]
Jan 25 10:36:29 mail postfix/cleanup[28992]: 37B8951012C: message-id=<20110125103620.394637500@senderhost2.com>
Jan 25 10:36:29 mail postfix/qmgr[27819]: 37B8951012C: from=, size=39726, nrcpt=1 (queue active)
Jan 25 10:36:30 mail postfix/error[28994]: 37B8951012C: to=, orig_to=, relay=none, delay=0.86, delays=0.78/0.01/0/0.07, dsn=4.0.0, status=SOFTBOUNCE (User unknown in virtual alias table)

file /etc/postfix/virtual originally had

newsletter-1@domain.tld user-1.domain

which looks suspiciously like the problem at hand
changed this to

newsletter-1@domain.tld user-1

which resulted in

Jan 25 11:00:38 mail postfix/smtpd[29842]: 4A0F4510154: client=unknown[189.106.172.100]
Jan 25 11:00:38 mail postfix/cleanup[29942]: 4A0F4510154: message-id=<6624655873.CGMDHHMZ196440@clbqla.qsneyoudrpu.info>
Jan 25 11:00:38 mail postfix/qmgr[29423]: 4A0F4510154: from=, size=2380, nrcpt=1 (queue active)
Jan 25 11:00:38 mail postfix/error[29944]: 4A0F4510154: to=, relay=none, delay=0.49, delays=0.42/0.01/0/0.06, dsn=4.0.0, status=SOFTBOUNCE (User unknown in virtual alias table)

Postfix is working fine on machine where webserver and mailserver is on the same machine.

Does anyone have an idea where this problem is originating and what to do to fix it?

Thanks

Status: 
Active

Comments

I've seen this sometimes when the Postfix gets confused due to the system's hostname being the same as a virtual domain name.

What is the hostname on this system, and what is the real domain name in question?

Also, what does the /etc/mailname file contain, if it exists?

hostname is mail.domain.tld In Virtualmin > (domain) > services > DNS Domain > Address records, there are 8 records, one of the names is mail.domain.tld which is the same as the system's hostname. 7 records point to NAT'd address, and localhost.domain.tld points to 127.0.0.1. From the local system requests to www.domain.tld would go to local machine and fail, but this should not be a problem because local machine is only a mail processor.

real domain name is domain.tld (middle component in above example)

there is no file /etc/mailname, command find / | grep mailname finds no files

There should be no problem changing the machine name to either somethingelse.domain.tld or whatever.someotherdomain.tld

I will see if I can do this in Virtualmin/Webmin, otherwise I will have to go to the documentation for real admin CLI commands :-)

In Webmin > Networking > Network Configuration > Hostname and DSN Client I have changed the hostname to somethingelse.domain.tld, a name that does not exist in the authoritative DNS records, will send email to valid address and check maillogs

It looks like there is some progress.

Stopped / Started postfix

SInce debugging is turned on, bounces have been "soft" bounces, and there were a lot of messages to valid address held in queue that appeared to be reprocessed. They still failed, but the target email address now does not have the extra ".domain" before the @domain.tld

Jan 27 19:32:54 mail postfix/error[13039]: 4548A510267: to=<user-1@domain.tld>, orig_to=<newsletter-1@domain.tld>, relay=none, delay=1255, delays=1255/0.3/0/0.07, dsn=4.0.0, status=SOFTBOUNCE (User unknown in virtual alias table)

for mail sent to an alias, and

Jan 27 23:52:15 mail postfix/smtpd[20219]: NOQUEUE: reject: RCPT from web83507.mail.sp1.yahoo.com[216.252.120.163]: 450 4.1.1 <user-1@domain.tld>: Recipient address rejected: User unknown in virtual alias table; from=<sender@yahoo.com> to=<user-1@domain.tld> proto=SMTP helo=<web83507.mail.sp1.yahoo.com>

for mail sent directly to a valid address

So it appears the problem of translating user-1@domain.tld into user-1.domain@domain.tld has been solved by changing the system's hostname from mail.domain.tld to somethingelse.domain.tld

Now if I can only get the mail delivered!

by changing the system's hostname from mail.domain.tld to somethingelse.domain.tld

Two other thing you may need to do there are --

  1. Edit /etc/hosts, and make sure that your new hostname is listed next to your public IP address

  2. Edit /etc/postfix/main.cf, and look for the "mydestination" line. When you find it, make sure that your new hostname is one of the domains listed as part of that line.

Once you make those changes, restart Postfix (with /etc/init.d/postfix restart), and then see if email delivery begins working for you.

  1. /etc/hosts did have somethingelse.domain.tld as expected

  2. /etc/postfix/main.cf "mydestination" was still at prior mail.domain.tld, changed to somethingelse.domain.tld to match hostname.

Restarted postfix, checked mail, mail still failing with status=SOFTBOUNCE (User unknown in virtual alias table), rebooted machine, same error. Messages with valid target email address (both explicitly and though alias) reprocessed and re-failed.

Perhaps I should rebuild a replacement machine from scratch with a different hostname at the very beginning?

I'm not sure if this helps here or is relevant at all, but I vaguely recall a similar issue with certain email addresses, and that was caused by a setting in Webmin -> Servers -> Postfix Mail Server -> Address Rewriting and Masquerading.

Here it might be the Rewrite "user" to "user@$mydomain" that makes trouble?

I had the same question. It might be making trouble but it seems to be working. Here is a recent entry from the logs

Jan 28 15:36:55 srvr4 postfix/qmgr[2575]: 405B7510177: from=<root@domain.tld>, size=818, nrcpt=1 (queue active)
Jan 28 15:36:56 srvr4 postfix/error[6016]: 405B7510177: to=<root@domain.tld>, orig_to=<root>, relay=none, delay=7981, delays=7980/0.38/0/0.08, dsn=4.0.0, status=SOFTBOUNCE (User unknown in virtual alias table)

So there is a good translation from "root" to "root@domain.tld". However I checked, and there is not an explicit root@domain.tld address defined in the Virtualmin for the domain, there is not an alias for the virtualmin virtual server owner for root@domain.tld, however the SOFTBOUNCE message text above is the same for this non-existant address as it is for a valid user or alias.

Both you and Jamie have identified certain patterns that appear to be causing software confusion and if the system, the application, or the instance are confused, trying to deal with it rationally will just get me more confused. For instance - is root@domain.tld created from the Postfix instance on the server, or from the virtual hostname, or from cosmic rays. And have the changes made so far been complete or are there leftover tracks that I can't see from where I'm looking?

I'm more convinced now to rebuild the machine with a hostname of somehost.somedomain.sometld so that there is no overlap between the host domain and the virtual name of mail.domain.tld.

Thanks for the observation and pointers.

You might try turning that rewrite option which I mentioned in my first post off for a test, before you reinstall the machine. :)

It appeared I already had tried the rewrite option change because it was set to off. I was sure I had reloaded postfix, but figured it wouldn't hurt to try a trick from another operating system so I rebooted the server. I am beginning to see mail in some of the mailboxes. Based on this I'm going to assume either I did not do a reload or restart.

Thunderbird mail client is beginning to be able to download messages from the server, these appear to be messages left in queues or mailboxes from several weeks ago.

I flushed the queue to see if those messages would reprocess and deliver, they did not, probably related to incompatibility of prior rewrite actions and current configuration. Also found messages "mail for example.com loops back to myself" tracked this down to configuration change in /etc/postfix/virtual made while attempting to diagnose problem, replaced user-1@domain.tld user-1@domain.dld with user-1@domain.tld user-1.domain reloaded and rebooted, and it looks like mail is now flowing.

I will follow this up with a description of the (hopefully) final working configuration.