[Rt-commit] r10358 - rt/branches/3.7-RTIR-RELENG/lib/RT/Interface

ruz at bestpractical.com ruz at bestpractical.com
Tue Jan 15 15:24:14 EST 2008


Author: ruz
Date: Tue Jan 15 15:24:14 2008
New Revision: 10358

Modified:
   rt/branches/3.7-RTIR-RELENG/lib/RT/Interface/Email.pm

Log:
* better handle empty addresses when figuring out sender

Modified: rt/branches/3.7-RTIR-RELENG/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-RTIR-RELENG/lib/RT/Interface/Email.pm	Tue Jan 15 15:24:14 2008
@@ -904,13 +904,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