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.

I have the following problem. I use Gmail mail services for my domain name mydomain.com. My server with hostname server.my-datacenter.net sends messages to the users of my website with "from" and "reply-to" address info@mydomain.com. Postfix (and Exim on my second server) automatically adds email addresses root@server.my-datacenter.net or www-data@server.my-datacenter.net to all outgoing emails.

Some mail servers are not accepting emails from my server because server.my-datacenter.net itself does not accept mail. I can not create MX records for server.my-datacenter.net to make my server accept external emails because this domain/subdomain belongs to my data center and was assigned automatically as a hostname. I can not change hostname from server.my-datacenter.net to mydomain.com because in this case I can not have PTR record (my datacenter wants 5 EUR/month for a custom PTR record).

Server's IP address has a reverse PTR record to server.my-datacenter.net. Domain name mydomain.com has a SPF record (included Gmail + my server's IP address).

What can I do in this situation? Is it possible to force Exim and Postfix to use root@mydomain.com and www-data@mydomain.com instead of root@server.my-datacenter.net and www-data@server.my-datacenter.net? If yes, how can I do it in Postfix and Ensim.

If I do it, is it OK that outgoing email will contain email addresses with a different domain (not a server's hostname)?

2DBF7646459     1219 Wed Feb 20 11:46:01  root@server.my-datacenter.net
(host a.mail.server[xxx.xxx.xxx.xxx] said: 450 4.1.8 <root@server.my-datacenter.net>: Sender address rejected: Domain not found (in reply to RCPT TO command))
                                         email@address
share|improve this question
    
The 0 in the domain is due to a copy error or a configuration error ?I can't resolve server.my-datacenter.net nor server.my0datacenter.net, but it is maybe normal... –  Dom Feb 21 '13 at 17:18
    
It's an error. I replaced the real domain names. –  user1821484 Feb 21 '13 at 17:21

1 Answer 1

up vote 0 down vote accepted

Since you didn't explicitly set the hostname to use, exim when it starts up makes a valiant effort to figure it out from the hostname of the machine and/or the IP address. To override this in exim, explicitly set what you want it to be. Add to the global section of your config:

primary_hostname = mail.mydomain.com

...which assumes that hostname mail.mydomain.com resolves to the IP address of your mail server. Now when it receives email from non-qualified users, it will append @mail.mydomain.com instead of @server.my-datacenter.net.

share|improve this answer
    
Thanks Todd. Do you know what I need to change in Postfix? /etc/postfix/main.cf file contains: myhostname = server.my-datacenter.net, mydestination = server.my-datacenter.net, localhost.my-datacenter.net, , localhost, myorigin = /etc/mailname which contains server.my-datacenter.net. What is the difference among "myhostname", "mydestination" and "myorigin"? –  user1821484 Feb 22 '13 at 9:19

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.