[rt-users] Sorting e-mail into queues automatically using procmail

Nicôle Layne nlayne at telebarbados.com
Tue Aug 24 16:37:11 EDT 2010


This is under the assumption that all queues are correctly setup and e-mail enabled through the web interface, and the reply address has format <queue-name>@rt.mydomain.com and comment address has format <queue-name>-comment at rt.mydomain.com.

 

I'm trying to get incoming e-mail to automatically go directly into whichever queue/ticket they are related to or create a new ticket if no matching ones exist.

 

I will have too many queues to have two line items within mailgate or the aliases file per queue.

 

I'm able to send and receive e-mail (via PostFix) to the default rt user and this user successfully accepts all e-mail for the rt.mydomain.com domain.

 

Since enabling procmail and the following scripts, I have no idea where the e-mail goes - it's successfully delivered, but it does not update existing tickets (with a Subject line match) and it does not create any new. It's not even in rt's mailbox.

 

Here's an example of my procmail.log:

 

--- Logging /home/rt/procmail_log.log

 for rt, 

procmail: [8153] Mon Aug 23 21:30:56 2010

procmail: Assigning "MAILDOMAIN=rt.mydomain.com

"

procmail: Assigning "RT_MAILGATE=/opt/rt3/bin/rt-mailgate

"

procmail: Assigning "RT_URL=http://rt.mydomain.com/

"

procmail: Assigning "LOGABSTRACT=all

"

procmail: Skipped "

"

procmail: Skipped "

"

procmail: Assigning "LASTFOLDER={

"

procmail: Opening "{

"

procmail: Acquiring kernel-lock

procmail: Notified comsat: "rt at 35475:./{

"

>From me at mydomain.com  Mon Aug 23 21:30:56 2010

 Subject: Creating environmental ticket

  Folder: {                                                                                                             

 

The contents of my ./procmailrc:

 

#Preliminaries

                SHELL=/bin/sh               #Use the Bourne shell (check your path!)

                #MAILDIR=${HOME}        #First check what your mail directory is!

                MAILDIR="/var/mail/rt/"

                #LOGFILE=${MAILDIR}/procmail.log

                LOGFILE="/home/rt/procmail_log.log"

                LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "

                VERBOSE=yes

                MAILDOMAIN="rt.telebarbados.com"

                RT_MAILGATE="/opt/rt3/bin/rt-mailgate"

                #RT_MAILGATE="/usr/local/bin/rt-mailgate"

                RT_URL="http://rt.telebarbados.com/"

 

                LOGABSTRACT=all

 

 

                :0

                {

                # the following line extracts the recipient from Received-headers.

                # Simply using the To: does not work, as tickets are often created

                # by sending a CC/BCC to RT

                TO=`formail -c -xReceived: |grep $MAILDOMAIN |sed -e 's/.*for *<*\(.*\)>* *;.*$/\1/'`

                QUEUE=`echo $TO| $HOME/get_queue.pl`

                ACTION=`echo $TO| $HOME/get_action.pl`

                :0 h b w 

                |/usr/bin/perl $RT_MAILGATE --queue $QUEUE --action $ACTION --url $RT_URL

                }

 

I have tested get_queue.pl and get_action.pl scripts successfully but let me know if including them helps.

 

Any help and/or guidance you can give would be greatly appreciated.

 

Kind regards,
Nicôle

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100824/51917296/attachment.htm>


More information about the rt-users mailing list