[Rt-commit] r10370 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Wed Jan 16 10:44:30 EST 2008


Author: ruz
Date: Wed Jan 16 10:44:28 2008
New Revision: 10370

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm

Log:
 r10392 at cubic-pc (orig r10358):  ruz | 2008-01-15 23:24:14 +0300
 * better handle empty addresses when figuring out sender


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	Wed Jan 16 10:44:28 2008
@@ -887,13 +887,15 @@
     my $head = shift;
 
     #Figure out who's sending this message.
-    my $From = $head->get('Reply-To')
-        || $head->get('From')
-        || $head->get('Sender');
-    return ( ParseAddressFromHeader($From) );
-}
-
+    foreach my $header ('Reply-To', 'From', 'Sender') {
+        my $addr_line = $head->get($header) || next;
+        my ($addr, $name) = ParseAddressFromHeader( $addr_line );
+        # only return if the address is not empty
+        return ($addr, $name) if $addr;
+    }
 
+    return (undef, undef);
+}
 
 =head2 ParseErrorsToAddressFromHead HEAD
 


More information about the Rt-commit mailing list