RtBounceHandler: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
 
(No difference)

Latest revision as of 15:36, 6 April 2016

NAME

rtbouncehandler

SYNOPSIS

rtbouncehandler | rt-mailgate --queue myqueue --action comment --url http://rt.example.org/ --timeout 300

README

This program scans an incoming message for common bounce indications (these days this is most commonly a DSN notice). If it detects it is a bounce, it scans the message for what could be the reason and the ticket number associated with the original message. If the ticket number is found, it then emits a message suitable for feeding into "rt-mailgate" to log a comment.

To route bounces here, set up an alias called "rtbounce" which pipes into this program as indicated in the SYNOPSIS above. Next, configure RT to use that address as the SMTP sender address for all correspondence in RT_SiteConfig.pm by setting this flag:

Set($SendmailArguments , '-frtbounce@rt.example.org -oi -t');

This works when using the default mail command method in RT on unix.

Now, all bounces to messages sent via RT should be sent to that bounce address, and ultimately forwarded into this program. You probably will also want to create an "owner-rtbounce" alias to catch any errors it might throw off. This should be aliased to a real person's email address.

For highest safety, the queue name specified should probably not have any autoresponder enabled.

If you're really courageous, you could also auto-close the ticket as per the "rt-mailgate" man page on performing multiple actions. Note that not all bounces received here will be for permanent delivery errors.

PREREQUISITES

Requires "Mail::DeliveryStatus::BounceParser" and its prerequisites.

BUGS

Seems to handle the common bounce formats we get.

Since the messages it creates is from the complaining mail daemon, installations with strict controls (such as the SpamAssassin filter) may fail to log bounces. However, apply the following patch and configure VERP in your RT_SiteConfig

Set($VERPPrefix, 'rtbounce+');

and everything is swell

--- /opt/src/RT/rtbouncehandler 2009-09-14 16:01:14.000000000 -0400
+++ local/bin/rtbouncehandler   2009-10-22 20:03:04.000000000 -0400
@@ -31,7 +31,12 @@
 # pull out some bits and pieces
 my ($ticketnum,$dsn,$fromaddr);

-chomp($fromaddr = $message->head->get('from'));
+if( $ENV{EXTENSION} ){
+    ($fromaddr = $ENV{EXTENSION} ) =~ y/=/@/;
+}
+else{
+    chomp($fromaddr = $message->head->get('from'));
+}

 # Ensure that the message is some sort of bounce, else bail.
 if ($bounce->is_bounce) {

Note: This also allows you to set the bounce notice sender to an explicit user without hard-coding it in the script e.g;

|EXTENSION=root@localhost rtbouncehandler | rt-mailgate ...
 
 

Would ensure all watchers receive notification of the bounce.

AUTHOR

Vivek Khera. For help, post to the RT users mailing list. I'm hanging out there.

Copyright 2007 Vivek Khera. This program is distributed under the same terms as Perl itself. Please refer to the Perl license for details.

SOURCE

Perl program is available from http://labs.mailermailer.com/files/rtbouncehandler.bz2