Subject: | get() sends the wrong IMAP specifier |
In 1.2209, the "get" method is documented as accepting body part specifiers, which should be sent to IMAP as "BODY[$partSpecifiers]".
However, while the method sets up the specification correctly, it is not passed to fetch - instead, the specifier is passed to fetch. The net effect is that get aliases fetch.
See below:
sub get {
my ( $self, $number, $part ) = @_;
my $arg = $part ? "BODY[$part]" : 'RFC822';
# $part should be $arg in the following line
return $self->fetch( $number, $part );
}
As a work-around, one can call fetch with "BODY[$part]".
Further, fetch is documented as accepting a message range and returning a hash. In fact, it returns an array - and seems to only access the first message of a range. If I specify $mbx->fetch("1:2", 'BODY[HEADER]'), I get the headers for message 1, with 2 extra lines shown as 21,22 below:
19 "Date: Fri, 28 Apr 2017 11:50:22 -0400 (EDT)\cM\cJ"
20 "\cM\cJ"
21 ")\cM\cJ"
22 'X'
Message 2 is not marked seen.
If I fetch just "1", the return value ends normally.
19 "Date: Fri, 28 Apr 2017 11:50:22 -0400 (EDT)\cM\cJ"
20 "\cM\cJ"
This appears to be a documentation error.
(Server is dovecot.)