1

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
Oguz Bilgic
  • 169
  • 6

3 Answers3

3

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.

Paul
  • 1,288
  • 13
  • 25
  • 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) –  Nov 18 '11 at 01:25
  • Can you post the `relayhosts` and `relay domains` sections from your main.cf (sanitised) – Paul Nov 18 '11 at 02:23
  • added to question. – Oguz Bilgic Nov 18 '11 at 03: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 '11 at 03:38
  • what is the difference between mydomain and mydestination – Oguz Bilgic Nov 19 '11 at 01:58
2

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

Julien
  • 510
  • 1
  • 5
  • 11
1

You can using transport.

main.cf
transport_maps = hash:/etc/postfix/transport

/etc/postfix/transport
user51@xxx.com smtpserver.google.com:25

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

84104
  • 12,905
  • 6
  • 45
  • 76