I'm trying to get incoming e-mail to automatically go directly into whichever queue/ticket they are related to or create a new one if none exist and the right queue e-mail setup in the web interface is used.
I will have too many queues to have two line items within mailgate per queue.
A similar issue was discussed here (Procmail: Pipe to Program, Otherwise Return Error to Sender), but I thought it best to open a new case instead of tagging on what appeared to be an answer to that person's query.
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 relative domain.
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.
Here's and example of my ./procmail.log:
procmail: [23048] Mon Aug 23 14:26:01 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@18337:./{
"
From [email protected] Mon Aug 23 14:26:01 2010
Subject: RE: [RT.mydomain.com #1] Test Ticket
Folder: { 1616
Does the notified comsat portion mean that it notified RT?
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="home/rt//procmail.log"
LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "
VERBOSE=yes
MAILDOMAIN="rt.mydomain.com"
RT_MAILGATE="/opt/rt3/bin/rt-mailgate"
#RT_MAILGATE="/usr/local/bin/rt-mailgate"
RT_URL="http://rt.mydomain.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 know that my get_queue.pl and get_action.pl scripts work, as those have been previously tested.
Any help and/or guidance you can give would be greatly appreciated.
- Nicôle
You might want to push the routing function onto RT instead of trying to implement it in procmail. Let the email be sent to RT, and then use something like the EmailRouting or SetOwnerAndQueueBySubject scrip examples to short the email into the appropriate queue.
From the RT Wiki ( https://rt-wiki.bestpractical.com/wiki/Main_Page ) :
EmailRouting -> https://rt-wiki.bestpractical.com/wiki/EmailRouting
SetOwnerAndQueueBySubject -> https://rt-wiki.bestpractical.com/wiki/SetOwnerAndQueueBySubject