# Activate this line to debug SSL: # use IO::Socket::SSL qw(debug4); #### # HELLO # Reminder: hello is also send again after starttls $smtp->hello( $cs->{ clientID } ) or die "Error: " . $smtp->message() ; # STARTTLS if ( !$smtp->starttls() ) { if ( ref $smtp eq 'Net::SMTP' ) { die "NET::SMPT failed to upgrade connection after connection message: " . $smtp->message() . "Possible reasons for this may be firewalls or antivirus protection software (such as mail shields). You can activate debugging for IO::Socket::SSL and \$dbgSMTP to search for other possible reasons\n" ; } else { die "starttls failed with Error: " . $smtp->message() . "You can activate debugging for IO::Socket::SSL and \$dbgSMTP to search for possible reasons\n" ; } } ; # AUTHENTICATE ... # Finish with this line, it may contain extra error info if($@) { print STDERR "Error sending mail: $@"; }