Add config option for TLS

pull/285/head
Felix Ableitner 5 years ago
parent 61ede42800
commit a46245eecc

@ -171,6 +171,9 @@ $CONF['smtp_port'] = '25';
// Used in the HELO when sending emails from Postfix Admin
$CONF['smtp_client'] = '';
// Set 'YES' to use TLS when sending emails.
$CONF['smtp_sendmail_tls'] = 'NO';
// Encrypt
// In what way do you want the passwords to be crypted?
// md5crypt = internal postfix admin md5

@ -1398,12 +1398,15 @@ function smtp_mail($to, $from, $data, $password = "", $body = "") {
return false;
} else {
smtp_get_response($fh);
fputs($fh, "STARTTLS\r\n");
smtp_get_response($fh);
stream_set_blocking ($fh, true);
stream_socket_enable_crypto($fh, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
stream_set_blocking ($fh, true);
if (Config::read_string('smtp_sendmail_tls') === 'YES') {
fputs($fh, "STARTTLS\r\n");
smtp_get_response($fh);
stream_set_blocking ($fh, true);
stream_socket_enable_crypto($fh, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
stream_set_blocking ($fh, true);
}
fputs($fh, "EHLO $smtp_server\r\n");
smtp_get_response($fh);

Loading…
Cancel
Save