Skip to content

Commit

Permalink
Merge pull request #12321 from ADDCreative/patch-1
Browse files Browse the repository at this point in the history
Check if encryption negotiation failed
  • Loading branch information
mhcwebdesign committed May 11, 2023
2 parents f4dd6e0 + 982260e commit 2f7e4e3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions upload/system/library/mail/smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,16 @@ public function send() {

$this->handleReply($handle, 220, 'Error: STARTTLS not accepted from server!');

stream_socket_enable_crypto($handle, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
}
if (stream_socket_enable_crypto($handle, true, STREAM_CRYPTO_METHOD_TLS_CLIENT) !== true) {
throw new \Exception('Error: TLS could not be established!');
}

if (!empty($this->smtp_username) && !empty($this->smtp_password)) {
fputs($handle, 'EHLO ' . getenv('SERVER_NAME') . "\r\n");

$this->handleReply($handle, 250, 'Error: EHLO not accepted from server!');
}

if (!empty($this->smtp_username) && !empty($this->smtp_password)) {
fputs($handle, 'AUTH LOGIN' . "\r\n");

$this->handleReply($handle, 334, 'Error: AUTH LOGIN not accepted from server!');
Expand Down

0 comments on commit 2f7e4e3

Please sign in to comment.