Filtering Out of Office notifications from rt (Request Tracker)

Posted on Thursday, December 17, 2009 by Nicki

It's that time of the year again, where everyone has Out of Office replies set. One of our systems send out daily reports of files processed, and the Reply To address is set to the rt Queue address. This causes unnecessary requests being opened in rt for the Out of Office replies. What can one do?

Well, that's what I love about open source, procmail is your friend.

I found some references where people had exactly the same problem, so here is the solution I used based on those references.

Create/modify the procmailrc file (in my case it sits in /usr/local/etc/procmailrc).


# Trash Outlook autoreplies
:0 w
* ^subject:.*Out of Office AutoReply

# Pass to rt
:0 w
|/usr/local/bin/rt-mailgate --queue $QUEUE --action $ACTION --url http://xx.yyy.zz/rt

The $1 and $2 variables are arguments passed to procmail, see the arguments after the -a command line switch below. These are stored in $QUEUE and $ACTION and passed to rt-mailgate in turn to make the solution more generic and reuseable.

Then I modified the postfix aliases file to pass all mail for the queue to procmail:

raxas-request: "|/usr/local/bin/procmail -a Raxas -a correspond"

Then remember to execute newaliases and postfix reload, and send some test mails.

Source links: