rjbs / Email-Sender

a perl library for sending email
56 stars 39 forks source link

incomplete error message in exception when SSL fails #67

Open jazzkutya opened 4 years ago

jazzkutya commented 4 years ago

|| 151 if ($self->_security eq 'starttls') { || 152 $self->_throw("can't STARTTLS: " . $smtp->message) || 153 unless $smtp->starttls(%{ $self->ssl_options }); || 154 }

You forgot to include $@ in the message of the exception. $@ contains vital information on the problem whose absence makes me curse everyone involved in email stuff. PR later

AnotherOneAckap commented 1 year ago

Stuck in the same problem, got message:

server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 220 [xx.xx.xx.xx] MailerQ ESMTP
server_1     | Net::SMTP=GLOB(0x563be98b9390)>>> EHLO localhost.localdomain
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 250-PIPELINING
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 250-SIZE 104857600
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 250-8BITMIME
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 250-ENHANCEDSTATUSCODES
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 250-SMTPUTF8
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 250-DSN
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 250-STARTTLS
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 250 Pleased to meet you
server_1     | Net::SMTP=GLOB(0x563be98b9390)>>> STARTTLS
server_1     | Net::SMTP=GLOB(0x563be98b9390)<<< 220 2.0.0 Ready to start TLS
server_1     | ERROR [Wed Mar 22 12:11:53 2023] can't STARTTLS: 2.0.0 Ready to start TLS

After halfday of googling, checkong and reverse engineering, found true problem

SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Which was in $@ after $smtp->starttls but masked with $self->_throw

Looks like the easiest way to fix it is to include $@ into message.