# Always be safe use strict; use warnings; # Use the module use Mail::IMAPClient; use IO::Socket::SSL; my $imap = Mail::IMAPClient->new( User => 'xxxxxxx', Password => 'xxxxxxxx', Uid => 1, Debug => 1, Socket => IO::Socket::SSL->new ( Proto => 'tcp', PeerAddr => 'server.name.de', PeerPort => 993, SSL_verify_mode => 'SSL_VERIFY_PEER', SSL_verifycn_scheme => 'imap', ), ) or die "IMAP Failure: $@"; # $imap->Socket($ssl); # $imap->connect; my $folders = $imap->folders or die "List folders error: ", $imap->LastError, "\n"; print "Folders: @$folders\n"; $imap->logout or die "Logout error: ", $imap->LastError, "\n";