My smtp servers domain(origin) is xxx.com. When I try to email user51@xxx.com from smtp server, it does not deliver that mail since this user51 is not hosted on this smtp server. user51 has an google apps account with domain xxx.com

So I want smtp server to deliver mail remotely if that user is not hosted locally.

How is that possible with postfix?

partial main.cf

# mydomain
relayhost = $mydomain
# relay_domains

3 Answers 3


Try removing xxx.com or $myorigin from mydestination in main.cf


If the "real" xxx.com is pointed at Google Apps for email (ie, its MX records as the internet understands them are pointing at Googles email servers), then your local SMTP should not claim that it is a relay for that domain. It is incorrectly configured.

All you need to do is remove xxx.com as a domain from your smtp server.

If on the other hand, the real email server for xxx.com is your server, then it should correctly attempt to deliver locally and fail if the account doesn't exist.

You cannot have an email domain in two different places like this. You can have two different email servers that are valid recipients for a domains email, but once they take possession of the email it is up to them to ensure they cooperate and get it to the emailbox of the user.

  • xxx.com is pointed to google. I also changed hostname of smtp server to smtp.xxx.com, and removed xxx.com from domain of smtp server. So what do I need to send valid emails from my smtp server as xxx.com (noreply@xxx.com)
    – Oguz Bilgic
    Nov 18, 2011 at 1:25
  • Can you post the relayhosts and relay domains sections from your main.cf (sanitised)
    – Paul
    Nov 18, 2011 at 2:23
  • added to question. Nov 18, 2011 at 3:21
  • 1
    $mydomain is set to the hostname fqdn minus the first part, so if your hostname is smtp.xxx.com then your are still saying you are a relayhost for xxx.com, so it will still try to deliver locally.
    – Paul
    Nov 18, 2011 at 3:38
  • what is the difference between mydomain and mydestination Nov 19, 2011 at 1:58

You can using transport.

transport_maps = hash:/etc/postfix/transport

user51@xxx.com smtpserver.google.com:25

Don't forget to postmap /etc/postfix/transport

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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