IMAP via ssl?

Discussion in 'Perl Misc' started by Josef Möllers, Mar 5, 2004.

  1. 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?

    --
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize
    -- T. Pratchett
    Josef Möllers, Mar 5, 2004
    #1
    1. Advertising

  2. Josef Möllers

    Abhinav Guest

    Josef Möllers wrote:

    > 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
    Abhinav, Mar 5, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik Ormåsen

    Curier-IMAP and imap.create()

    Henrik Ormåsen, Aug 19, 2006, in forum: Ruby
    Replies:
    0
    Views:
    175
    Henrik Ormåsen
    Aug 19, 2006
  2. Jon Fi
    Replies:
    4
    Views:
    530
    Kashia Buch
    Oct 21, 2006
  3. jasonnaylor
    Replies:
    1
    Views:
    252
    jasonnaylor
    Apr 16, 2008
  4. Adam Akhtar
    Replies:
    1
    Views:
    176
    Eric Hodel
    Dec 15, 2008
  5. Abhishiv Saxena

    Support for IMAP IDLE in net/imap

    Abhishiv Saxena, Jul 3, 2009, in forum: Ruby
    Replies:
    4
    Views:
    191
    Eric Hodel
    Jul 4, 2009
Loading...

Share This Page