How do I stop postfix from handling my mail?

Posted by Tatu Ulmanen on Server Fault See other posts from Server Fault or by Tatu Ulmanen
Published on 2012-09-26T21:25:00Z Indexed on 2012/09/26 21:39 UTC
Read the original article Hit count: 333

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 [email protected], 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=<[email protected]>, 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

© Server Fault or respective owner

Related posts about postfix

Related posts about google-apps