Subject: | get_envelope() fails when subject line ends with backslash |
Using Mail::IMAPClient, If the last character of a message's subject
line is a backslash, calling get_envelope() fails.
This is 64-bit perl 5.10.1 on CentOS 6.3. Confirmed the problem happens
with multiple IMAP servers, including Microsoft Exchange 2010.
When the problem occurs, a separate bug is causing this warning:
Use of uninitialized value $bs in concatenation (.) or string at
/usr/local/share/perl5/Mail/IMAPClient.pm line 2032.
That line is:
$self->_debug( "get_envelope: msg $msg returns ref: " . $bs || "UNDEF" );
Since . is higher on the order of operations than || this needs
parentheses around the ($bs || "UNDEF").
With debugging turned on, the relevant bit looks something like this:
Sending: 5 UID FETCH 1 ENVELOPE
Sent 24 bytes
Read: \t* 1 FETCH (UID 1 ENVELOPE ("Mon, 18 Mar 2013 18:23:04 +0000"
"test\\\\" (("myname" NIL "myuser" "mydomain")) (("myname" NIL "myuser"
"mydomain")) (("myname" NIL "myuser" "mydomain"))
(("recipient@example.com" NIL "recipient" "example.com")) NIL NIL NIL
"<messageid@server>"))
Read: \t5 OK UID FETCH Completed