Postfix Issue with address formatting.

So my default domain is server1.myserverdomain.com (configured when installing centos 5)

I have a virtual server setup for www.mynewdomain.com.
Username is mynewdomain.

When using a website to send mail (i.e a forum sends out the “click here to configm your email” type of email), some hosts decline it and bounce it back because my username is formatted as: “mynewdomain@server1.myserverdomain.com” instead of “mynewdomain@mynewdomain.com”.

Any idea how to change this? It has something to do with how postfix modified the FROM field. I noticed that if i turn off [Rewrite “user” to “user @ $mydomain”] over in Postfix Mail Server -> Address Rewriting and Masquerading, it tries to use just “mynewdomain” as the sender (basically the username itself). SO i know this option works, but i can’t seem to find how it decides what $mydomain variable is pulled. It seems that when it pulls the $mydomain variable, it chooses the server domain (server1.myserverdomain.com) instead the virtual domain (mynewdomain.com).

Any help would be appreciated, i’ve been trying to figure out a fix for a couple weeks now and my client is getting fed up with the problem.

Thanks in advance!

As a quicker fix, i wouldn’t mind setting the “from” email to something else (like a valid email). I am trying this now through something like this in masquerading: mynewdomain@server1.myserverdomain.com mynewdomain@mynewdomain.com and see if it works.

Ok so this is what i did. It’s a pain in the butt, but i have to do this every time i create a new virtual server for it to properly send emails to comcast (and many others):

Step 1: go to Webmin -> Servers -> Postfix Mail Server and select Canonical Mapping.
Stem 2: At the bottom, next to TABLES FOR SENDER ADDRESSES, select the “Map specifications” radio button and click the three dotes to the right of the input field.
Step 3: On new page that opens, select the MAPPING FILE radio button. In the box to the right type “/etc/postfix/generic” (without quotes, off course) and hit SAVE. On next page hit SAVE AND APPLY, then go back to Canonical Mapping.
Step 4: At the very bottom right, select “Edit Sender Canonical Maps”.
Step 5: At the top right of the new page click on “Add a new mapping”.
Step 6: On the new page that opens type a description to remember what it was. In the NAME field, type the EXISTING email that is going out (in my case, mynewdomain@server1.myserverdomain.com). In MAPS TO… field type the email address you would like it to be changed to (in my case mynewdomain@mynewdomain.com).
Step 7: Hit Save Mapping

That’s it!

Now i wish this would be automatic, but for now, it allows me to send emails to any picky hosts!

I have also gone into DNS configuration and i added an address record of server1.myserverdomain.com to point to the same IP as myserverdomain.com (since this was never created in virtualmin, but server1.myserverdomain.com was created at installation of centos5)

I’ll verify if this fixes issue. Since postfix only uses mynewdomain@server1.myserverdomain.com to communicate to the receiving end, and the specified “FROM” email defined in the web site php script shows up to the end receiver, all emails sent from the web site should work fine now.

I’ll confirm once all DNS entries get updated (within 24 hrs).

It works now. Just adding the server1.myserverdomain.com to point to the same IP as myserverdomain.com solves the issue. Looks like comcast has no issue any more.

No more need to setup canonical mapping!!! :slight_smile:

I feel like i have been typing this in a blog since i’m the only one replying to my own problem haha!
I’ll leave the messages here in case anyone else has the same issue!

I’m glad you got it working, thanks for letting us know how you did it!

I had the same issue as wireaudio and his solution to create a Canonical Map was the only one I could find that works.

In my case I have multiple virtual domains so adjusting the DNS for the server is not an option.

But I still have a question: Can this be somehow automated/set through Virtualmin?

So far Virtualmin, through the backup and restore functions, allows me to move virtual domains around (on different IPs) seamlessly - without any manual interventions.

This solution, however, forces me to manage a mapping file every time I move a domain.

Thanks