Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if encryption negotiation failed #12321

Merged
merged 1 commit into from
May 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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