email/fax fixes for 4.2 branch (#2022)

I updated this to latest 4.2.
This commit is contained in:
jebsolutions 2016-10-31 16:21:26 -04:00 committed by FusionPBX
parent b887eb4c82
commit 0ed5657ec6
3 changed files with 39 additions and 0 deletions

View File

@ -169,6 +169,13 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = ''; $array[$x]['default_setting_description'] = '';
$x++; $x++;
$array[$x]['default_setting_category'] = 'email';
$array[$x]['default_setting_subcategory'] = 'smtp_validate_certificate';
$array[$x]['default_setting_name'] = 'bolean';
$array[$x]['default_setting_value'] = 'true';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'set to false to ignore SSL certificate warnings e.g. for self-signed certificates';
$x++;
$array[$x]['default_setting_category'] = 'login'; $array[$x]['default_setting_category'] = 'login';
$array[$x]['default_setting_subcategory'] = 'password_reset_key'; $array[$x]['default_setting_subcategory'] = 'password_reset_key';
$array[$x]['default_setting_name'] = 'text'; $array[$x]['default_setting_name'] = 'text';

View File

@ -529,6 +529,22 @@ if(!function_exists('fax_split_dtmf')) {
else { else {
$mail->IsSMTP(); // set mailer to use SMTP $mail->IsSMTP(); // set mailer to use SMTP
} }
//optionally skip certificate validation
if (isset($_SESSION['email']['smtp_validate_certificate'])) {
if ($_SESSION['email']['smtp_validate_certificate']['boolean'] == "false") {
// this works around TLS certificate problems e.g. self-signed certificates
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
}
}
if ($_SESSION['email']['smtp_auth']['var'] == "true") { if ($_SESSION['email']['smtp_auth']['var'] == "true") {
$mail->SMTPAuth = $_SESSION['email']['smtp_auth']['var']; // turn on/off SMTP authentication $mail->SMTPAuth = $_SESSION['email']['smtp_auth']['var']; // turn on/off SMTP authentication
} }

View File

@ -189,6 +189,22 @@
default: $mail->IsSMTP(); break; default: $mail->IsSMTP(); break;
} }
} else $mail->IsSMTP(); } else $mail->IsSMTP();
// optional bypass TLS certificate check e.g. for self-signed certificates
if (isset($_SESSION['email']['smtp_validate_certificate'])) {
if ($_SESSION['email']['smtp_validate_certificate']['boolean'] == "false") {
// this is needed to work around TLS certificate problems
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
}
}
$mail->SMTPAuth = $smtp['auth']; $mail->SMTPAuth = $smtp['auth'];
$mail->Host = $smtp['host']; $mail->Host = $smtp['host'];
if ($smtp['port']!=0) $mail->Port=$smtp['port']; if ($smtp['port']!=0) $mail->Port=$smtp['port'];