Subject: | append_string can invalidate a good $date if $date not wrapped in double quotes |
Since 2.x Mail::IMAPClient append_string handles $date in the following
manner:
if (defined($date)) {
$date =~ s/^\s+//g;
$date =~ s/\s+$//g;
}
Relevant RFC 3501 details:
date-time = DQUOTE date-day-fixed "-" date-month "-" date-year
SP time SP zone DQUOTE
date-day-fixed = (SP DIGIT) / 2DIGIT
Per RFC 3501, a valid $date value could begin with a space followed by a
digit (SP DIGIT). The code should try to do the right thing but not
break potentially valid values in the process.
Note: this can cause problems with imapsync version ~1.335 and greater
as code in imapsync looks like this:
sub good_date {
my ($d) = @_;
return($d) if (! $usedatemanip); # <- *this was added*
$d = UnixDate(ParseDate($d), "%d-%b-%Y %H:%M:%S %z");
$d = "\"$d\"";
return($d);
}