Update fax_to_email.php
Fix fax to email when using method and smtp_port.
This commit is contained in:
parent
668264d856
commit
472c7efb3b
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
James Rose <james.o.rose@gmail.com>
|
James Rose <james.o.rose@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$output_type = "file"; //file or console
|
||||||
|
|
||||||
if (defined('STDIN')) {
|
if (defined('STDIN')) {
|
||||||
//get the document root php file must be executed with the full path
|
//get the document root php file must be executed with the full path
|
||||||
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
||||||
|
|
@ -266,8 +268,10 @@ if(!function_exists('fax_split_dtmf')) {
|
||||||
ini_set('memory_limit', '96M');
|
ini_set('memory_limit', '96M');
|
||||||
|
|
||||||
//start the to cache the output
|
//start the to cache the output
|
||||||
ob_end_clean();
|
if ($output_type == "file") {
|
||||||
ob_start();
|
ob_end_clean();
|
||||||
|
ob_start();
|
||||||
|
}
|
||||||
|
|
||||||
//add a delimeter to the log
|
//add a delimeter to the log
|
||||||
echo "\n---------------------------------\n";
|
echo "\n---------------------------------\n";
|
||||||
|
|
@ -514,12 +518,24 @@ if(!function_exists('fax_split_dtmf')) {
|
||||||
|
|
||||||
//prepare the mail object
|
//prepare the mail object
|
||||||
$mail = new PHPMailer();
|
$mail = new PHPMailer();
|
||||||
$mail->IsSMTP(); // set mailer to use SMTP
|
if (isset($_SESSION['email']['method'])) {
|
||||||
|
switch($_SESSION['email']['method']['text']) {
|
||||||
|
case 'sendmail': $mail->IsSendmail(); break;
|
||||||
|
case 'qmail': $mail->IsQmail(); break;
|
||||||
|
case 'mail': $mail->IsMail(); break;
|
||||||
|
default: $mail->IsSMTP(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$mail->IsSMTP(); // set mailer to use SMTP
|
||||||
|
}
|
||||||
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
|
||||||
}
|
}
|
||||||
$mail->Host = $_SESSION['email']['smtp_host']['var'];
|
$mail->Host = $_SESSION['email']['smtp_host']['var'];
|
||||||
|
if (strlen($_SESSION['email']['smtp_port']['var']) > 0) {
|
||||||
|
$mail->Port = $_SESSION['email']['smtp_port']['var'];
|
||||||
|
}
|
||||||
if (strlen($_SESSION['email']['smtp_secure']['var']) > 0 && $_SESSION['email']['smtp_secure']['var'] != 'none') {
|
if (strlen($_SESSION['email']['smtp_secure']['var']) > 0 && $_SESSION['email']['smtp_secure']['var'] != 'none') {
|
||||||
$mail->SMTPSecure = $_SESSION['email']['smtp_secure']['var'];
|
$mail->SMTPSecure = $_SESSION['email']['smtp_secure']['var'];
|
||||||
}
|
}
|
||||||
|
|
@ -545,6 +561,7 @@ if(!function_exists('fax_split_dtmf')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//output to the log
|
//output to the log
|
||||||
|
echo "smtp_host: ".$_SESSION['email']['smtp_host']['var']."\n";
|
||||||
echo "smtp_from: ".$_SESSION['email']['smtp_from']['var']."\n";
|
echo "smtp_from: ".$_SESSION['email']['smtp_from']['var']."\n";
|
||||||
echo "smtp_from_name: ".$_SESSION['email']['smtp_from_name']['var']."\n";
|
echo "smtp_from_name: ".$_SESSION['email']['smtp_from_name']['var']."\n";
|
||||||
echo "tmp_subject: $tmp_subject\n";
|
echo "tmp_subject: $tmp_subject\n";
|
||||||
|
|
@ -615,13 +632,15 @@ if(!function_exists('fax_split_dtmf')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//open the file for writing
|
//open the file for writing
|
||||||
$fp = fopen($_SESSION['server']['temp']['dir']."/fax_to_email.log", "w");
|
if ($output_type == "file") {
|
||||||
//get the output from the buffer
|
//open the file
|
||||||
$content = ob_get_contents();
|
$fp = fopen($_SESSION['server']['temp']['dir']."/fax_to_email.log", "w");
|
||||||
//clean the buffer
|
//get the output from the buffer
|
||||||
ob_end_clean();
|
$content = ob_get_contents();
|
||||||
//write the contents of the buffer
|
//clean the buffer
|
||||||
fwrite($fp, $content);
|
ob_end_clean();
|
||||||
fclose($fp);
|
//write the contents of the buffer
|
||||||
|
fwrite($fp, $content);
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue