[Rt-commit] rt branch, 4.0/add-from-to-mail-error-messages, created. rt-4.0.14rc1-1-g4c3669c

Thomas Sibley trs at bestpractical.com
Wed Jul 17 13:56:32 EDT 2013


The branch, 4.0/add-from-to-mail-error-messages has been created
        at  4c3669cc27abdec4ad77481fb05a940af2837cf3 (commit)

- Log -----------------------------------------------------------------
commit 4c3669cc27abdec4ad77481fb05a940af2837cf3
Author: Christian Loos <cloos at netcologne.de>
Date:   Tue Jul 16 12:38:00 2013 +0200

    always log the email address to help debugging
    
    [Adjusted to use the From: header rather than $ErrorsTo, which is not
    necessarily the From: value.]
    
    Signed-off-by: Thomas Sibley <trs at bestpractical.com>

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index f259a76..575d412 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1452,6 +1452,7 @@ sub Gateway {
 
     my $head = $Message->head;
     my $ErrorsTo = ParseErrorsToAddressFromHead( $head );
+    my $From = $head->get("From");
 
     my $MessageId = $head->get('Message-ID')
         || "<no-message-id-". time . rand(2000) .'@'. RT->Config->Get('Organization') .'>';
@@ -1583,7 +1584,7 @@ sub Gateway {
                 Explanation => $ErrStr,
                 MIMEObj     => $Message
             );
-            return ( 0, "Ticket creation failed: $ErrStr", $Ticket );
+            return ( 0, "Ticket creation From: $From failed: $ErrStr", $Ticket );
         }
 
         # strip comments&corresponds from the actions we don't need
@@ -1628,7 +1629,7 @@ sub Gateway {
                     Explanation => $msg,
                     MIMEObj     => $Message
                 );
-                return ( 0, "Message not recorded: $msg", $Ticket );
+                return ( 0, "Message From: $From not recorded: $msg", $Ticket );
             }
         } elsif ($unsafe_actions) {
             my ( $status, $msg ) = _RunUnsafeAction(
@@ -1727,6 +1728,8 @@ sub _RunUnsafeAction {
         @_
     );
 
+    my $From = $args{Message}->head->get("From");
+
     if ( $args{'Action'} =~ /^take$/i ) {
         my ( $status, $msg ) = $args{'Ticket'}->SetOwner( $args{'CurrentUser'}->id );
         unless ($status) {
@@ -1736,7 +1739,7 @@ sub _RunUnsafeAction {
                 Explanation => $msg,
                 MIMEObj     => $args{'Message'}
             );
-            return ( 0, "Ticket not taken" );
+            return ( 0, "Ticket not taken, by email From: $From" );
         }
     } elsif ( $args{'Action'} =~ /^resolve$/i ) {
         my $new_status = $args{'Ticket'}->FirstInactiveStatus;
@@ -1751,11 +1754,11 @@ sub _RunUnsafeAction {
                     Explanation => $msg,
                     MIMEObj     => $args{'Message'}
                 );
-                return ( 0, "Ticket not resolved" );
+                return ( 0, "Ticket not resolved, by email From: $From" );
             }
         }
     } else {
-        return ( 0, "Not supported unsafe action $args{'Action'}", $args{'Ticket'} );
+        return ( 0, "Not supported unsafe action $args{'Action'}, by email From: $From", $args{'Ticket'} );
     }
     return ( 1, "Success" );
 }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list