Mail::IMAPClient via SSL

Discussion in 'Perl Misc' started by Greg G, May 25, 2005.

  1. Greg G

    Greg G Guest

    I'm trying to get Mail::IMAPClient to work via SSL. I'm running into a
    problem. Here's the output:

    # ./
    SSL OK? 1
    SSL says: * OK mailtest Sendmail Server IMAP4rev1

    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 "" {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/ 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/ 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',

    print "SSL OK? " . (defined $ssl) . "\n";

    print "SSL says: " . <$ssl> . "\n";

    $imap = Mail::IMAPClient->new(Server => "",
    Socket => $ssl,
    User => "ggtest103z\",
    Password => "abcdef",
    Debug => 1,

    print STDERR " \'[email protected]\' \'$!\' |" . (defined $imap) . "|\n";

    $imap->State ($imap->Connected);
    print "Set State : " . $imap->State . "\n";
    print "Logged in $!\n";

    exit 0;


    Any idea what's happening here? I've tested the mail server and it
    works fine via SSL.


    -Greg G
    Greg G, May 25, 2005
    1. Advertisements

  2. Greg G

    Greg G Guest

    My experience is that if I don't escape the single-quotes, my
    variables don't get printed.
    I expect to get a "1" if $imap is defined and nothing if it's not.
    Either way, this line has no effect on my code falling down.

    -Greg G
    Greg G, May 31, 2005
    1. Advertisements

  3. You have entered the Twilight Zone then, as that cannot happen
    unless there is something else going on that we've not been shown.

    If you can reproduce a situation where that occurs, then please
    post it here and we can help you understand whatever misunderstanding
    it is that you are operating under.

    You shouldn't expect that, as it can change at any perl revision.

    defined() is documented to return only "a true value", not any
    particular true value, so it may start returning 100 or 'is defined'
    in the future.

    Relying on undocumented features is not a good programming practice.

    Right, I did not say that it did.
    Tad McClellan, May 31, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.