Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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