From: | "Ron Rademaker" <ron [...] virtualbuilding.nl> |
To: | <bug-Mail-IMAPClient [...] rt.cpan.org> |
Subject: | Looks like pretty much none of the methods is working |
Date: | Thu, 6 Nov 2003 11:55:47 +0100 |
Hello,
It looks like none of the methods in Mail::IMAPClient are working, I'm
probably doing something wrong... I guess this bug can be fixed by
improving documentation :-)
Here are some examples (in all, $host, $id and $password are set ok...):
Sample script:
#!/usr/bin/perl -w
use strict;
use Mail::IMAPClient::BodyStructure;
use Mail::IMAPClient;
my $imap = Mail::IMAPClient->new( Server => $host,User => $id,Password
=> $password) or die "Cannot connect to $host as $id: $@";
$imap->Debug(1);
$imap->Select("INBOX");
$imap->fetch_hash("INTERNALDATE");
$imap->logout;
Result:
Autoloading: Select INBOX
Sending: 2 Select INBOX
Sent 16 bytes
Read: * FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\Draft \Answered \Flagged \Deleted \Seen)] Limited
* 2 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1066745093] Ok
2 OK [READ-WRITE] Ok
Autoloading: fetch_hash INTERNALDATE
Sending: 3 fetch_hash INTERNALDATE
Sent 27 bytes
Read: 3 NO Error in IMAP command received by server.
Sending: 4 LOGOUT
Sent 10 bytes
Read: * BYE Courier-IMAP server shutting down
4 OK LOGOUT completed
Sample script 2:
#!/usr/bin/perl -w
use strict;
use Mail::IMAPClient::BodyStructure;
use Mail::IMAPClient;
my $imap = Mail::IMAPClient->new( Server => $host,User => $id,Password
=> $password) or die "Cannot connect to $host as $id: $@";
$imap->Debug(1);
$imap->Select("INBOX");
$imap->messages;
$imap->logout;
Result:
Autoloading: Select INBOX
Sending: 2 Select INBOX
Sent 16 bytes
Read: * FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\Draft \Answered \Flagged \Deleted \Seen)] Limited
* 2 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1066745093] Ok
2 OK [READ-WRITE] Ok
messages is all lower-case. May conflict with future methods. Change
method name to be mixed case or all upper case to ensure upward
compatability at ./Email.pm line 27
Sending: 3 messages
Sent 12 bytes
Read: 3 NO Error in IMAP command received by server.
Sending: 4 LOGOUT
Sent 10 bytes
Read: * BYE Courier-IMAP server shutting down
4 OK LOGOUT completed
Sample script 3:
#!/usr/bin/perl -w
use strict;
use Mail::IMAPClient::BodyStructure;
use Mail::IMAPClient;
my $imap = Mail::IMAPClient->new( Server => $host,User => $id,Password
=> $password) or die "Cannot connect to $host as $id: $@";
$imap->Debug(1);
$imap->Select("INBOX");
my @msg = $imap->Search("ALL");
foreach (@msg) {
print "Message: " . $_ . "\n";
}
$imap->logout;
Result
Autoloading: Select INBOX
Sending: 2 Select INBOX
Sent 16 bytes
Read: * FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\Draft \Answered \Flagged \Deleted \Seen)] Limited
* 2 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1066745093] Ok
2 OK [READ-WRITE] Ok
Autoloading: Search ALL
Sending: 3 Search ALL
Sent 14 bytes
Read: * SEARCH 1 2
3 OK SEARCH done.
Message: * SEARCH 1 2
Message: 3 OK SEARCH done.
Sending: 4 LOGOUT
Sent 10 bytes
Read: * BYE Courier-IMAP server shutting down
4 OK LOGOUT completed
I could go on a while longer, but I don't think that'll be useful, guess
you get te point. Anything between the Select and the logout fails. (I
also tried messages as Messages... doesn't matter). It always gives the
<tagid> NO Error in IMAP command received by server.
Last sample doesn't give an error... but @msg doesn't contain the
information one (at least I) would expect, I'd expect data I can use in
something like get_header or get_envelope.
Kind regards,
Ron Rademaker