Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: ggersh [...] ctc.net
Cc:
AdminCc:

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



Date: Thu, 26 May 2005 09:23:53 -0400
From: Greg G <ggersh [...] ctc.net>
To: bug-Mail-IMAPClient [...] rt.cpan.org
Subject: IMAPClient via SSL problem
I'm trying to get Mail::IMAPClient to work via SSL. I'm running into a problem. This is on Solaris 9. Here's the output from my test program: # ./imap_test.pl SSL OK? 1 SSL says: * OK mailtest Sendmail Server IMAP4rev1 (2.1.5/smserver-2-1-5-build-1174) Using Mail::IMAPClient version 2.2.9 and perl version 5.8.6 (5.008006) '0' '' |1| Set State : 1 Sending literal string in two parts: 1 Login "ggtest103z@mydomain.net" {6} then: abcdef Sending: 1 Login "XXXXXX" {6} Sent 38 bytes Can't call method "can_read" on an undefined value at /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583. # # then: abcdef Sending: 1 Login "XXXXXX" {6} Sent 38 bytes Can't call method "can_read" on an undefined value at /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583. # --------------------------- Here's the code: ------------------------- #!/usr/local/bin/perl -w use IO::Socket::SSL; use Mail::IMAPClient; my $ssl = IO::Socket::SSL->new (Proto=>'tcp', #SSL_verify_mod=>0x00, PeerAddr=>"mailtest.mydomain.net", PeerPort=>993); print "SSL OK? " . (defined $ssl) . "\n"; print "SSL says: " . <$ssl> . "\n"; $imap = Mail::IMAPClient->new(Server => "mailtest.mydomain.net", Socket => $ssl, Timeout=>5, User => "ggtest103z\@mydomain.net", Password => "abcdef", Debug => 1, ); print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n"; $imap->State ($imap->Connected); print "Set State : " . $imap->State . "\n"; $imap->login(); print "Logged in $!\n"; exit 0; -------------------- Any idea what's happening here? I've tested the mail server and it works fine via SSL. Thanks. -Greg G
On Thu May 26 09:29:20 2005, ggersh@ctc.net wrote: Show quoted text
> > I'm trying to get Mail::IMAPClient to work via SSL. I'm running into a > problem. This is on Solaris 9. > > Here's the output from my test program: > > # ./imap_test.pl > SSL OK? 1 > SSL says: * OK mailtest Sendmail Server IMAP4rev1 > (2.1.5/smserver-2-1-5-build-1174) > > Using Mail::IMAPClient version 2.2.9 and perl version 5.8.6 (5.008006) > '0' '' |1| > Set State : 1 > Sending literal string in two parts: 1 Login "ggtest103z@mydomain.net" {6} > > then: abcdef > > Sending: 1 Login "XXXXXX" {6} > > Sent 38 bytes > Can't call method "can_read" on an undefined value at > /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583. > # > # > then: abcdef > > Sending: 1 Login "XXXXXX" {6} > > Sent 38 bytes > Can't call method "can_read" on an undefined value at > /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583. > # > --------------------------- > Here's the code: > > ------------------------- > #!/usr/local/bin/perl -w > > use IO::Socket::SSL; > use Mail::IMAPClient; > > > my $ssl = IO::Socket::SSL->new (Proto=>'tcp', > #SSL_verify_mod=>0x00, > PeerAddr=>"mailtest.mydomain.net", > PeerPort=>993); > > print "SSL OK? " . (defined $ssl) . "\n"; > > print "SSL says: " . <$ssl> . "\n"; > > $imap = Mail::IMAPClient->new(Server => "mailtest.mydomain.net", > Socket => $ssl, > Timeout=>5, > User => "ggtest103z\@mydomain.net", > Password => "abcdef", > Debug => 1, > ); > > > print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n"; > > $imap->State ($imap->Connected); > print "Set State : " . $imap->State . "\n"; > $imap->login(); > print "Logged in $!\n"; > > exit 0; > > -------------------- > > Any idea what's happening here? I've tested the mail server and it > works fine via SSL. > > Thanks. > > -Greg G >
From: Philippe Bricout <philippe.bricout [...] mongueurs.net>
Show quoted text
> On Thu May 26 09:29:20 2005, ggersh@ctc.net wrote:
> > > > I'm trying to get Mail::IMAPClient to work via SSL. > > ------------------------- > > #!/usr/local/bin/perl -w > > > > use IO::Socket::SSL; > > use Mail::IMAPClient; > > > > > > my $ssl = IO::Socket::SSL->new (Proto=>'tcp', > > #SSL_verify_mod=>0x00, > > PeerAddr=>"mailtest.mydomain.net", > > PeerPort=>993); > > > > print "SSL OK? " . (defined $ssl) . "\n"; > > > > print "SSL says: " . <$ssl> . "\n"; > > > > $imap = Mail::IMAPClient->new(Server => "mailtest.mydomain.net", > > Socket => $ssl, > > Timeout=>5, > > User => "ggtest103z\@mydomain.net", > > Password => "abcdef", > > Debug => 1, > > ); > > > > > > print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n"; > > > > $imap->State ($imap->Connected); > > print "Set State : " . $imap->State . "\n"; > > $imap->login(); > > print "Logged in $!\n"; > > > > exit 0;
This is not a bug. When you want to use an SSL socket, the documentation says you must not invoke 'connect' method. If you look how the "new" constructor works in source you will see in 'sub new' : return $self->connect if $self->Server and !$self->Socket; As we want to bypass 'connect' method, one way to do it (c) is to create Mail::IMAPClient object invoking 'new' *without* args. Example (see imtestExample.pl in distribution) : -*-*-*-* #!/usr/bin/perl -w use Mail::IMAPClient; use IO::Socket::SSL; use strict; my $host = "ip.or.fqdn"; my $user = 'testuser'; my $pwd = 'test'; my $socketssl = IO::Socket::SSL->new( PeerAddr => $host, PeerPort => 993, Proto => 'tcp', Timeout =>5, # Debug => 1, ) or die "No socket! - IO::Socket::SSL->new failed to $host\n"; sleep(2); #$socketssl->autoflush(1); my $imap = Mail::IMAPClient->new; $imap->User($user); $imap->Password($pwd); $imap->Server($host); $imap->Port(993); #$imap->Debug(1); $imap->State($imap->Connected); $imap->Socket($socketssl); $imap->capability; print "*******Status before login: ",$imap->Status,"\n"; $imap->login; print "*******Status after login: ",$imap->Status,"\n"; $imap->noop; $imap->Select("INBOX"); for my $m (@{$imap->search("TEXT SUBJECT")} ) { print "Message $m:\t",$imap->subject($m),"\n"; } $imap->logout; -*-*-*-*
From: Philippe Bricout <philippe.bricout [...] mongueurs.net>
Oops, I post too fast... Reference to 'new constructor' was inrelevent about Greg's script. Just consider my post as another how-to. :-/ Sorry Greg.
New maintainer. Fixed in 2.99_02 (overlap with other bugreports)