IMAP via ssl?

J

Josef Möllers

Hi,

according to IMAPClient's manual page, it should be possible to access
an IMAP server via an SSL connection.
I tried:
($server is the right server name and $prot is "imaps", $user and
$password are also correct)

if ($prot eq "imaps") {
$port = getservbyname($prot, 'tcp');
my $s = IO::Socket::SSL->new(PeerAddr=>$host,
PeerPort => $port,
Proto => 'tcp');
die $@ unless defined $s;

$imap = Mail::IMAPClient->new(Socket => $s,
User => $user,
Password => $password,);
$imap->State($imap->Connected());
$imap->login or die $@;

but I get the error message
Use of uninitialized value in string eq at
/usr/lib/perl5/site_perl/5.8.1/Mail/IMAPClient.pm line 1435.
and then
Error sending '1 Login "XXXXXXXX" {12}
YYYYYYYYYYYY
' to IMAP: at Perl/IMAP.pl line 45
Error sending '1 Login "XXXXXXXX" {12}
YYYYYYYYYYYY
' to IMAP: at Perl/IMAP.pl line 45.

What am I doing wrong?
 
A

Abhinav

Josef said:
Hi,

according to IMAPClient's manual page, it should be possible to access
an IMAP server via an SSL connection.
I tried:
($server is the right server name and $prot is "imaps", $user and
$password are also correct)
Hope you have added the following :

use strict;
use warnings;
if ($prot eq "imaps") {
$port = getservbyname($prot, 'tcp');

$port should be initialised ??? (use strict to find out) if
getservbyname() actually returns something..you may want to do
my $port;
$port = getservbyname($prot, 'tcp') or die ("Could Not get Server By
Name");
my $s = IO::Socket::SSL->new(PeerAddr=>$host,
PeerPort => $port,
Proto => 'tcp');
die $@ unless defined $s;

$imap = Mail::IMAPClient->new(Socket => $s,
User => $user,
Password => $password,);
$imap->State($imap->Connected());
$imap->login or die $@;

but I get the error message
Use of uninitialized value in string eq at
/usr/lib/perl5/site_perl/5.8.1/Mail/IMAPClient.pm line 1435.
and then
Error sending '1 Login "XXXXXXXX" {12}
YYYYYYYYYYYY
' to IMAP: at Perl/IMAP.pl line 45
Error sending '1 Login "XXXXXXXX" {12}
YYYYYYYYYYYY
' to IMAP: at Perl/IMAP.pl line 45.

What am I doing wrong?
Of course, TMTOWTDI :)

Regards
Abhinav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,585
Members
45,082
Latest member
KetonaraKetoACV

Latest Threads

Top