Menu

#5 SSL Support

open
nobody
None
5
2003-07-19
2003-07-19
Ken Gordon
No

My IMAP server requires SSL to connect. Is it possible for
IMAPAssassin to implement (or is it already implemented
and not obvious) SSL connections?

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I got this working with a bit of hacking about. Here are
    some notes:

    1) In IMAPAssassin you'll need to set up your own socket:

    use IO::Socket::SSL;
    $client = new IO::Socket::SSL($your_ssl_host_here);
    where $your_ssl_host_here is in the form "host.name.com:993"
    or whatever port your SSL IMAP host is listening on.

    2) Don't send the Server arg to the new method for IMAPClient.
    In fact, I ended up doing my own auth so I use no flags
    at all:
    It should still be possible to send the user name and
    password
    here and then do $IMAP->login, but my server didn't like
    that.

    my $IMAP = Mail::IMAPClient->new();

    3) The FAQ indicates that you *should* be able to associate the
    socket directly like this

    $IMAP->Socket( $client ); // Did not work for me
    $IMAP->Connected(1); // Did not work for me

    but in my experience that did not work. What did work was
    adding
    a method called use_socket() to Mail/IMAPClient.pm (in
    the lib dir)
    and calling it like this:

    // In IMAPAssassin:
    $IMAP->use_socket($client);

    // In IMAPClient.pm
    sub use_socket {
    my $self = shift;
    my ($sock) = @_;

    $self->Socket($sock);
    $self->State(Connected);
    $sock->autoflush(1);
    }

    The only difference here is that I am setting the state to
    Connected, and there is a method that *should* do that as
    well, but
    I could not get it to work right. (Yes, and also
    autoflush, but you
    could do that in step 1 as well if you wanted to.)

    That did the trick for me!

     
  • Arnab K Rana

    Arnab K Rana - 2007-04-29

    Logged In: YES
    user_id=248045
    Originator: NO

    I would like to request an easier way for users of IMAPasassin to take advantage of SSL support. Perhaps a simple option in the configuration file would be useful?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.