Postfix and hostname

Discussion related to network/web services such as Apache, BIND Sendmail, etc.

Postfix and hostname

Postby xy16644 » 29 Jul 2009, 13:09

Currently I have a server called:

alpha.mydomain.com

but my MX record is:

mail.mydomain.com (reverse DNS is setup for this domain too)

When I send email it appears to come from alpha.mydomain.com in the message headers. I dont want to change the hostname of the server so how can I force Postfix to send all out going mail as coming from mail.mydomain.com?

I run the latest version of Postfix, Procmail and Spamassasin all on the same box running FreeBSD 7.2.

Does the hostname of the server have to match your MX record or can it be different? If you can change it then where? I cant seem to find it...:e
xy16644
Member
 
Posts: 783
Joined: 13 Jul 2009, 14:19

Postby dennylin93 » 29 Jul 2009, 14:22

Usually $myhostname is set as the output of [cmd=$]hostname[/cmd]. What you want to change should be $myorigin in [file]/usr/local/etc/postfix/main.cf[/file]. Another option is masquerading, but I believe it's usually used for mail gateways.

I have a mail server called mail.example.com, but I want the mail to appear from example.com:
Code: Select all
$myhostname = mail.example.com
$mydomain = example.com
$myorigin = $mydomain


I'm using this configuration, but there's something weird with Mutt. It still sends mail that appears from mail.example.com. All other clients are OK though.

Take a look at Postfix Configuration Parameters and Postfix Address Rewriting.
dennylin93
Member
 
Posts: 784
Joined: 11 Dec 2008, 13:13

Postby xy16644 » 29 Jul 2009, 14:42

Changing:

Code: Select all
myorigin = $mydomain


to

Code: Select all
myorigin = mail.mydomain.com


didn't change anything for me. But changing:

Code: Select all
myhostname = mail.mydomain.com


seemed to do the trick!

If I look in the message headers, the before snaphot looks like this:

Code: Select all

Received: from alpha.mydomain.com ([xxx.xxx.xxx.xx]) by col0-mc4-f10.Col0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959);


after making the change:
Code: Select all
Received: from mail.mydomain.com ([xxx.xxx.xxx.xx]) by col0-mc2-f27.Col0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959);

Thanks very much for your help!
xy16644
Member
 
Posts: 783
Joined: 13 Jul 2009, 14:19


Return to Web & Network Services

Who is online

Users browsing this forum: No registered users and 2 guests