When I send a mail via php mail then postfix rewrites the from address like this.

For example:

From: info@mydomain

The from becomes: username@myhosthame

How can I stop this from happening? I want postfix to preserve the from address.


To fix the domain, you have to set the myorigin paramater in main.cf. It defaults to myhostname.

As to why the user is rewritten, by default local_recipient_maps is set to only allow mail from users with an account on the machine, or a defined alias. From main.cf.default:

local_recipient_maps = proxy:unix:passwd.byname $alias_maps
  • Thx, setting myorigin = $mydomain works. I am halfway there. I am just trying to figure out now how to replace "username" with ïnfo, so I get the "info@mydomain" email instead of "username@mydomain" – giorgio79 Aug 29 '13 at 4:00
  • Found this cyberciti.biz/tips/… – giorgio79 Aug 29 '13 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.