LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   sendmail: Routing dead mail to a shell command? (https://www.linuxquestions.org/questions/linux-networking-3/sendmail-routing-dead-mail-to-a-shell-command-100568/)

noisybastard 10-05-2003 03:57 PM

sendmail: Routing dead mail to a shell command?
 
Is there a way that I can run a shell command when an email is returned from a server because the account doesn't exist? People sign up on my site using fake email addresses sometimes and then I get a bunch of dead mail bouncing back to me. I'd like to be able to run a shell command that would call up a script to remove their email address from the database any time an account comes back dead. Thanks.

david_ross 10-05-2003 04:13 PM

In /etc/aliases you can add a line like:
xyz :|/path/to/script

This will send all mail sent to user "xyz" to that program/script. You may want to consider using a scoreboard and only delete mail once it has been rejected say 3 times in a row - this should account for any network issues.

After editing /etc/aliases you need to run:
newaliases


All times are GMT -5. The time now is 10:35 PM.