Possible Duplicate:
Why does Postfix deliver mails locally instead of relaying them to Google Apps?

Here's the situation:

I have a domain, let's say domain.com. That domain has Google Apps for Business enabled, so all mail delivered to @domain.com will end up at Google (MX records point to Google).

I have a PHP script at domain.com that I use to send mail to myself. But when the PHP script tries to send mail to test@domain.com, Postfix at that server decides that the recipient is a local user (because the address matches the domain Postfix itself is at), and tries to deliver the mail locally. But inevitably fails as the mailbox cannot be found.

How can I instruct Postfix to not try to handle locally any emails to @domain.com and just send them forward so Google can pick them up?

I have already removed $myhostname from mydestination field in Postfix's main.cf file, and I have restarted Postfix but Postfix still tries to deliver the mail locally. Here's a snip from mail.log that show the problem (addresses replaced):

postfix/pickup[20643]: AF718422E5: uid=33 from=<server>
postfix/cleanup[20669]: AF718422E5: message-id=<62e706bcca5a0de0bfec6baa576d88a5@server>
postfix/qmgr[20642]: AF718422E5: from=<server>, size=517, nrcpt=1 (queue active)
postfix/pipe[20678]: AF718422E5: to=<test@domain.com>, relay=dovecot, delay=0.62, delays=0.47/0.03/0/0.13, dsn=5.1.1, status=bounced (user unknown)
postfix/bounce[20680]: AF718422E5: sender non-delivery notification: 29598422E7
postfix/qmgr[20642]: AF718422E5: removed

marked as duplicate by mailq, Michael Hampton, HopelessN00b, Hubert Kario, pauska Oct 7 '12 at 15:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



local domains (domains that match $mydestination or the IP addresses in $inet_interfaces or $proxy_interfaces)

Reading that makes me wonder whether it's the IP address match in $inet_interfaces ? If so, set up relayhost = smtp.gmail.com:587 and add local_transport = smtp. Don't forget to set up SASL for SMTP auth.

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