Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Some mail servers are not accepting emails from my server because itself does not accept mail. I can not create MX records for 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 to 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 Domain name 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 and instead of and 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
(host a.mail.server[] said: 450 4.1.8 <>: Sender address rejected: Domain not found (in reply to RCPT TO command))
share|improve this question
The 0 in the domain is due to a copy error or a configuration error ?I can't resolve nor, 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
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 =

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

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

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.