1

I currently have php running on my desktop (OS X 10.6.7) with the ability to send emails via the mail() function by having set "relayhost" in /etc/postfix to my ISP as well having as an entry in /etc/postfix/relay_password.

What I would like to have happen (since this is a development computer) is for all emails sent via PHP's mail() function to be delivered to only one external address (so that it then shows up in my Mail.app inbox).

In /usr/local/lib/php.ini I have tried setting "sendmail_path = sendmail -i $email", but it is still delivered to the address specified in the call to mail() within the php script.

I have seen How to redirect all outgoing email from postfix to a single address for testing, but this did not help me.

2 Answers2

2

You can try this:

recipient_canonical_maps = pcre:/etc/postfix/recipient_canonical.pcre

Then put a catch-all in /etc/postfix/recipient_canonical.pcre:

/.*/ your@email.com
Cakemox
  • 24,141
  • 6
  • 41
  • 67
0

Write a wrapper for the sendmail executable or its currently-used equivalent that rewrites the destination, and put the script path in sendmail_path.

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
  • Tried this, could never get my wrapper script to do anything useful, which is no one's fault but mine. I'll keep this in mind if I need more flexibility than Cakemox's answer (such as preserving the original recipient as a header, or appended to the subject or something). – Matthew Peltzer Apr 19 '11 at 09:56