Skip to content

Commit

Permalink
Add TLS1.2 to SMTP (bcosca/fatfree#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcosca authored and nanawel committed Sep 15, 2018
1 parent 19af2a0 commit 27e7b00
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,14 @@ function send($message,$log=TRUE,$mock=FALSE) {
$reply=$this->dialog('EHLO '.$fw->HOST,$log,$mock);
if (strtolower($this->scheme)=='tls') {
$this->dialog('STARTTLS',$log,$mock);
if (!$mock)
stream_socket_enable_crypto(
$socket,TRUE,STREAM_CRYPTO_METHOD_TLS_CLIENT);
if (!$mock) {
$method=STREAM_CRYPTO_METHOD_TLS_CLIENT;
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
$method|=STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
$method|=STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
}
stream_socket_enable_crypto($socket,TRUE,$method);
}
$reply=$this->dialog('EHLO '.$fw->HOST,$log,$mock);
}
$message=wordwrap($message,998);
Expand Down

0 comments on commit 27e7b00

Please sign in to comment.