Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

One of my machines runs Postfix mail server. I have a situation that user successfully recieves mail on address user@mycustomdomain.com, but if he wants to send out an email, it's email address is being seen as user@mail.companymaindomain.com. In which file should I look for alias to change domain name for outgoing mail to user@mycustomdomain.com for certain users?

share|improve this question

3 Answers 3

Take a look please at generic mapping for outgoing SMTP mail Postfix masquerading or changing outgoing SMTP email or mail address

share|improve this answer

SMTP servers by default can accept unqualified From: users, for compatibility, but no properly written MUA should send mail without a properly qualified From: address. The solution claasz offers will just hide the problem with the client who is sending email without all of the proper headers.

I assume the user is sending via webmail, or possibly by a script (php/cgi/etc), but in these cases, you should adjust the settings locally, most webmail packages allow the user to specifiy the outgoing mail address. When it's being sent via script, you need to add the proper headers, usually From:, maybe also Reply-To: if you'd like that to be different than the From: address.

share|improve this answer
    
He doesn't mention any kind of webmail application –  claasz Jul 8 '13 at 11:39
    
@claasz The outgoing email address is set by the MUA, not the MTA unless it's not specified in the headers (though you can change it in the MTA, but it's not something done by default). –  NickW Jul 8 '13 at 11:43
    
So you are suggesting to fix the configuration of the application which creates the e-mail in the first place. OK. But maybe you should clarify this a little more since the original question is clearly asking about how to do that in Postfix itself. –  claasz Jul 8 '13 at 11:54

At least in Ubuntu this would be /etc/postfix/main.cf. Have a look at the Postfix documentation, particulary the $myorigin parameter.

share|improve this answer
    
$myorigin specifically states: For the sake of consistency between sender and recipient addresses, myorigin also specifies the domain name that is appended to an unqualified recipient address. Unqualified means you didn't add a domain, which pretty much no proper MUA does nowadays, which is why I mentioned webmail or script mail. –  NickW Jul 8 '13 at 11:46
    
In main.cf I have a myorigin set to: myorigin = $mydomain... –  Mark Zakred Jul 8 '13 at 12:21

Your Answer

 
discard

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.