How I setup procmail+fetchmail for RT

Hello all,

I thought I would share with others how I setup procmail to filter out
emails on my RT 3.6.5 system. My server is Fedora Core based.
If you do not have either of these two packages installed you can
installed them via yum or yumex.

I configured my .procmailrc file as follows:

.procmailrc*****
LOGFILE=/root/procmail.log

:open_mouth:

:open_mouth:

:open_mouth:

  • ^TO.*rt@mydomain.com
    |/usr/sbin/rt-mailgate --queue “CustomerSupport” --action correspond
    –url http://my-rt-url.com/

:open_mouth:

  • ^TO.*rt2address@mydomain.com
    |/usr/sbin/rt-mailgate --queue “CustomerOther” --action correspond
    –url http://my-rt-url.com/

end of .procmailrc*******

Let me explain a little.

  1. I am filtering out the noreply@mail.badcompany.com and
    another@badcompanyname.com email addresses before they get to the
    mailgate.
  2. I have two queues setup and I have a specific email address for
    each. If you wanted to you can have a single email address for Request
    Tracker and use Procmail to filter out and send the message to the
    correct queue but that is not what I am doing.

Now to get the emails to my Request Tracker server I am retrieving
them from our Exchange server via fetchmail with the following
command:
fetchmail -m “/usr/bin/procmail -f %F” --daemon 120
-m send the email to procmail for processing
-f is to specify a non standard .procmailrc file… I am using the
standard file but for some reason it does not work without the -f for
me…
-F flushes the email on the server once it is procesed.
–daemon 120 run fetchmail every 2 minutes.

If you want some statistics on what procmail has filtered out you can
you mailstat…BE CAREFULL

run
mailstat -kl /root/procmail.log (if this is what you specified in your
.procmailrc file)
if you do not put the -k in the logfile will be truncated to 0

I hope this helps some people.

Phil

I thought I would share with others how I setup procmail to filter out
emails on my RT 3.6.5 system.

We also use procmail to filter out email before it reaches mailgate,
although we run it directly from sendmail’s alias file rather that needing
to use fetchmail.

:open_mouth:

  • ^TO.*rt@mydomain.com
    |/usr/sbin/rt-mailgate --queue “CustomerSupport” --action correspond
    –url http://my-rt-url.com/

The other thing we do slightly differently is that we invoke the rt-mailgate
from our procmail file as follows:

:0
EXITCODE=|/usr/pkg/bin/rt-mailgate --queue bugs --action correspond --url http://my-rt-url/; echo $?

The reason we did it this way was that we found procmail wasn’t passing back
the exit code of the rt-mailgate to sendmail. So if our rt server was down
and rt-mailgate returned a temporary failure sendmail wouldn’t see this and
the email would be dropped.

I’m not sure whether you could have a similar problem with fetchmail.

Also, this was with whatever version of procmail we were running at the time
we started doing this. It’s quite possible that its no longer required, but
I’ve never found the time to look at it again. Though given that the version
we’re running is v3.22, which seems to be the latest, but which is quite old,
I suspect that nothing will have changed…

Duncan