diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php
index 3d0c73b650..6ed34a7fc7 100644
--- a/app/email_queue/resources/jobs/email_send.php
+++ b/app/email_queue/resources/jobs/email_send.php
@@ -161,108 +161,6 @@
$email_retry_count = 0;
}
-//create the email object
-/*
- $mail = new PHPMailer();
- 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();
- }
-*/
-
-//load default smtp settings
-/*
- if ($_SESSION['email']['smtp_hostname']['text'] != '') {
- $smtp['hostname'] = $_SESSION['email']['smtp_hostname']['text'];
- }
- $smtp['host'] = (strlen($_SESSION['email']['smtp_host']['text']) ? $_SESSION['email']['smtp_host']['text']: '127.0.0.1');
- if (isset($_SESSION['email']['smtp_port'])) {
- $smtp['port'] = (int) $_SESSION['email']['smtp_port']['numeric'];
- }
- else {
- $smtp['port'] = 0;
- }
- $smtp['secure'] = $_SESSION['email']['smtp_secure']['text'];
- $smtp['auth'] = $_SESSION['email']['smtp_auth']['text'];
- $smtp['username'] = $_SESSION['email']['smtp_username']['text'];
- $smtp['password'] = $_SESSION['email']['smtp_password']['text'];
- $smtp['from'] = $_SESSION['email']['smtp_from']['text'];
- $smtp['from_name'] = $_SESSION['email']['smtp_from_name']['text'];
-
- if (isset($_SESSION['voicemail']['smtp_from']) && strlen($_SESSION['voicemail']['smtp_from']['text']) > 0) {
- $smtp['from'] = $_SESSION['voicemail']['smtp_from']['text'];
- }
- if (isset($_SESSION['voicemail']['smtp_from_name']) && strlen($_SESSION['voicemail']['smtp_from_name']['text']) > 0) {
- $smtp['from_name'] = $_SESSION['voicemail']['smtp_from_name']['text'];
- }
-*/
-
-//overwrite with domain-specific smtp server settings, if any
- $sql = "select domain_setting_subcategory, domain_setting_value ";
- $sql .= "from v_domain_settings ";
- $sql .= "where domain_uuid = :domain_uuid ";
- $sql .= "and (domain_setting_category = 'email' or domain_setting_category = 'voicemail') ";
- $sql .= "and domain_setting_enabled = 'true' ";
- $parameters['domain_uuid'] = $domain_uuid;
- $database = new database;
- $result = $database->select($sql, $parameters, 'all');
- if (is_array($result) && @sizeof($result) != 0) {
- foreach ($result as $row) {
- if ($row['domain_setting_value'] != '') {
- $smtp[str_replace('smtp_','',$row["domain_setting_subcategory"])] = $row['domain_setting_value'];
- }
- }
- }
- unset($sql, $parameters, $result, $row);
-
-//value adjustments
- $smtp['auth'] = ($smtp['auth'] == "true") ? true : false;
- $smtp['password'] = ($smtp['password'] != '') ? $smtp['password'] : null;
- $smtp['secure'] = ($smtp['secure'] != "none") ? $smtp['secure'] : null;
- $smtp['username'] = ($smtp['username'] != '') ? $smtp['username'] : null;
-
-//option to disable smtp ssl or tls validation
-/*
- if (isset($_SESSION['email']['smtp_validate_certificate'])) {
- if ($_SESSION['email']['smtp_validate_certificate']['boolean'] == "false") {
- $mail->SMTPOptions = array(
- 'ssl' => array(
- 'verify_peer' => false,
- 'verify_peer_name' => false,
- 'allow_self_signed' => true
- )
- );
- }
- }
-*/
-
-//add smtp authentication
-/*
- $mail->SMTPAuth = $smtp['auth'];
- if (isset($smtp['hostname'])) {
- $mail->Hostname = $smtp['hostname'];
- }
- $mail->Host = $smtp['host'];
- if ($smtp['port'] != 0) {
- $mail->Port = $smtp['port'];
- }
- if ($smtp['secure'] != '') {
- $mail->SMTPSecure = $smtp['secure'];
- }
- if ($smtp['auth']) {
- $mail->Username = $smtp['username'];
- $mail->Password = $smtp['password'];
- }
- $mail->SMTPDebug = 4;
-*/
-
//get the voicemail details
$sql = "select * from v_voicemails ";
$sql .= "where voicemail_uuid in ( ";
@@ -403,6 +301,7 @@
//send the email
$email = new email;
+ $email->domain_uuid = $domain_uuid;
$email->from_address = $email_from_address;
$email->from_name = $email_from_name;
$email->recipients = $email_to;
@@ -412,89 +311,9 @@
$email->method = 'direct';
$sent = $email->send();
//$response = $email->email_error;
-
-//add to, from, fromname, custom headers and subject to the email
-/*
- $mail->From = $smtp['from'] ;
- $mail->FromName = $smtp['from_name'];
- $mail->Subject = $email_subject;
-
- $email_to = trim($email_to, "<> ");
- $email_to = str_replace(";", ",", $email_to);
- $email_to_array = explode(",", $email_to);
- if (count($email_to_array) == 0) {
- $mail->AddAddress($email_to);
- }
- else {
- foreach ($email_to_array as $email_address) {
- if (strlen($email_address) > 0) {
- echo "Add Address: $email_address\n";
- $mail->AddAddress(trim($email_address));
- }
- }
- }
-*/
-
-//add the body to the email
-/*
- $body_plain = remove_tags($email_body);
- //echo "body_plain = $body_plain\n";
- if ((substr($email_body, 0, 5) == "ContentType = "text/html; charset=utf-8";
- $mail->Body = $email_body."
";
- $mail->AltBody = $body_plain."\n";
- $mail->isHTML(true);
- }
- else {
- //$mail->Body = ($body != '') ? $body : $body_plain;
- $mail->Body = $body_plain."\n";
- $mail->AltBody = $body_plain."\n";
- $mail->isHTML(false);
- }
- $mail->CharSet = "utf-8";
-*/
//send the email
if ($sent) {
- //if ($mail->Send()) {
-
- /*
- $sql = "delete from v_email_queue_attachments ";
- $sql .= "where email_queue_uuid = :email_queue_uuid; ";
- $parameters['email_queue_uuid'] = $email_queue_uuid;
- $database = new database;
- $database->select($sql, $parameters);
-
- $sql = "delete from v_email_queue ";
- $sql .= "where email_queue_uuid = :email_queue_uuid; ";
- $parameters['email_queue_uuid'] = $email_queue_uuid;
- $database = new database;
- $database->select($sql, $parameters);
- */
-
- /*
- //build insert array
- $email_log_uuid = uuid();
- $array['email_queue'][0]['email_queue_uuid'] = $email_queue_uuid;
- $array['email_queue'][0]['email_status'] = 'sent';
- if (isset($field['message'])) {
- $array['email_queue'][0]['email_transcription'] = $field['message'];
- }
-
- //grant temporary permissions
- $p = new permissions;
- $p->add('email_queue_add', 'temp');
-
- //execute insert
- $database = new database;
- $database->app_name = 'email_queue';
- $database->app_uuid = 'ba41954e-9d21-4b10-bbc2-fa5ceabeb184';
- $database->save($array);
- unset($array);
-
- //revoke temporary permissions
- $p->delete('email_queue_add', 'temp');
- */
//set the email status to sent
$sql = "update v_email_queue ";