How to filter email based on sender address

blainarmstrong asked:

This is my first post to serverfault, so I hope you excuse me for asking what may seem like an obvious question. I have tried running a few Google searches, but I really don’t know where to begin.

Here’s the scenario: I have an online application that sends emails on behalf of the users (at their request, of course). The destination server then sends an autoreply. When the autoreply comes in (from a specified address, each time), I want to forward all of the mails from that address to a PHP script that will then do something else with the message.

Here’s the catch: the address that I am using to send the message does not actually exist on my server. I basically set the “From” field to [email protected], even though they don’t actually have a user account/email address on my system (nor do I want to create one, for security purposes.) So I will have to somehow create a filter that catches ALL incoming messages from this particular address. Is this doable, and if so, how do I do it? I’m running Dovecot on an Ubuntu server. I know next to nothing about configuring servers, so I’m going to need very specific, step-by-step instructions.

My answer:

Don’t send mail From: a nonexistent address if you’re actually expecting a reply. Use an address which actually exists, and then your app doesn’t need to do anything more than check the mail.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.