Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 63444
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: tinimi [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 3.26



Subject: Mail-IMAPClient bug in get_envelope
Date: Mon, 29 Nov 2010 19:37:31 +0200
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: tinimi <tinimi [...] gmail.com>
Hi. Mail-IMAPClient version: 3.25 Perl version 5.8.7 get_envelope fails on empty "Reply-To" header. this is example of envelope of message, that brokes it: Read: * 2 FETCH (UID 42895 ENVELOPE ("Mon, 29 Nov 2010 18:28:23 +0200" "test" (("Nikolay Kravchenko" NIL "nkravchenko" "***")) (("Nikolay Kravchenko" NIL "nkravchenko" "***")) () ((NIL NIL "***" "***")) NIL NIL NIL "***")) (i'm mask a few fields with stars). As your could see - there are just () instead of "reply-to". In email header "Reply-To:" exists, but empty. To fix it, I'm write stupid fix: IMAPClient/BodyStructure/Parse.pm: 12194 unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::replyto($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) 12195 { 12196 12197 # Parse::RecDescent::_trace(q{<<Didn't match subrule: [replyto]>>}, 12198 # Parse::RecDescent::_tracefirst($text), 12199 # q{envelopestruct}, 12200 # $tracelevel) 12201 # if defined $::RD_TRACE; 12202 # $expectation->failed(); 12203 # last; 12204 $_tok = ''; 12205 $text = substr($text, 1); 12206 } I'm comment lines 12197-12203 and add lines 12204 and 12205. This is just workaround, because I don't know perl. Also, seems this bug exists on another empty headers. Kind regards, Nick
Thanks for the report. I'm adding this to the list to fix for the next release.
Subject: Mail-IMAPClient relax get_envelope strictness and allow empty reply-to
Looking at RFC 3501, it appears the server response may not be proper. Your server response for get_envelope() was: Read: * 2 FETCH (UID 42895 ENVELOPE ("Mon, 29 Nov 2010 18:28:23 +0200" "test" (("Nikolay Kravchenko" NIL "nkravchenko" "***")) (("Nikolay Kravchenko" NIL "nkravchenko" "***")) () ((NIL NIL "***" "***")) NIL NIL NIL "***")) Per section 7.4.2 (FETCH Response -> ENVELOPE section) a "()" for reply- to is not legal. It states: If the Sender or Reply-To lines are absent in the [RFC-2822] header, or are present but empty, the server sets the corresponding member of the envelope to be the same value as the from member (the client is not expected to know to do this). Note: [RFC-2822] requires that all messages have a valid From header. Therefore, the from, sender, and reply-to members in the envelope can not be NIL. IF I read that correctly, NIL and () are both invalid. If you agree, you may want to file a bug with the developer of your IMAP server. Regardless, I've just patched the latest branch to relax checks and allow you to get at other data that is available. The change I made was in /lib/Mail/IMAPClient/BodyStructure/Parse.grammar. Here are the comments from the commit (see https://sourceforge.net/p/mail- imapclient/git/ci/d825fcd049fea7b95eb4de387e9968ca033d30cd/): commit d825fcd049fea7b95eb4de387e9968ca033d30cd Author: Phil Pearl (Lobbes) <> Date: Sat Jan 22 22:37:01 2011 -0500 - rt.cpan.org#63444: relax get_envelope, allow empty reply-to RFC 3501 7.4.2 FETCH=>ENVELOPE indicates reply-to should not be empty. This change relaxes that check for any addresses to allow caller to get other data that is available. - Parse.pm and Thread.pm both rebuilt via Parse::RecDescent - added 7 new tests in t/bodystructure.t
Mail::IMAPClient 3.26 has been released to CPAN. Please install it if you get a chance and let me know if you run into any more problems, thanks!