have a virtual alias setup in /etc/postfix/virtual that reads:

@mydomain.com mydomainincoming

I then have a pipe setup in /etc/aliases that reads:

mydomainincoming: "|/var/path_to_script/myscript.php"

whenever I send mail to more than one user such as addy1@mydomain.com and addy2@mydomain.com, my script is called twice and is passed the exact same email both times. For 3 users, the script is called 3X. How should I set this up so that my script only receives one email even if the email is sent to more than one user?

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

Have the script check the Message-ID header and only process each ID once.

link|improve this answer
Yes. I thought of doing this. I would have to store the id in some persistent storage like a database. I suppose there is no way to configure the catch-all pipe to script without using a local alias ? – Richard Castle Feb 6 '11 at 1:48
Unfortunately no. The other way to process email is to retrieve it from a mailbox somewhere, but a pipe alias is the superior mechanism where available. – Ignacio Vazquez-Abrams Feb 6 '11 at 1:50
Okay. thanks a lot! I will implement a message-ID check. – Richard Castle Feb 6 '11 at 7:09
feedback

Your Answer

 
or
required, but never shown

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