diff --git a/app/emails/app_languages.php b/app/emails/app_languages.php index bea6f2265e..fceabd53e1 100644 --- a/app/emails/app_languages.php +++ b/app/emails/app_languages.php @@ -481,6 +481,66 @@ $text['header-emails']['ru-ru'] = "Сообщения Электронной П $text['header-emails']['sv-se'] = "E-post"; $text['header-emails']['uk-ua'] = ""; +$text['header-settings']['en-us'] = "Settings"; +$text['header-settings']['ar-eg'] = ""; +$text['header-settings']['de-at'] = ""; +$text['header-settings']['de-ch'] = ""; +$text['header-settings']['de-de'] = ""; +$text['header-settings']['es-cl'] = ""; +$text['header-settings']['es-mx'] = ""; +$text['header-settings']['fr-ca'] = ""; +$text['header-settings']['fr-fr'] = ""; +$text['header-settings']['he-il'] = ""; +$text['header-settings']['it-it'] = ""; +$text['header-settings']['nl-nl'] = ""; +$text['header-settings']['pl-pl'] = ""; +$text['header-settings']['pt-br'] = ""; +$text['header-settings']['pt-pt'] = ""; +$text['header-settings']['ro-ro'] = ""; +$text['header-settings']['ru-ru'] = ""; +$text['header-settings']['sv-se'] = ""; +$text['header-settings']['uk-ua'] = ""; + +$text['header-connection']['en-us'] = "Connection"; +$text['header-connection']['ar-eg'] = ""; +$text['header-connection']['de-at'] = ""; +$text['header-connection']['de-ch'] = ""; +$text['header-connection']['de-de'] = ""; +$text['header-connection']['es-cl'] = ""; +$text['header-connection']['es-mx'] = ""; +$text['header-connection']['fr-ca'] = ""; +$text['header-connection']['fr-fr'] = ""; +$text['header-connection']['he-il'] = ""; +$text['header-connection']['it-it'] = ""; +$text['header-connection']['nl-nl'] = ""; +$text['header-connection']['pl-pl'] = ""; +$text['header-connection']['pt-br'] = ""; +$text['header-connection']['pt-pt'] = ""; +$text['header-connection']['ro-ro'] = ""; +$text['header-connection']['ru-ru'] = ""; +$text['header-connection']['sv-se'] = ""; +$text['header-connection']['uk-ua'] = ""; + +$text['header-result']['en-us'] = "Result"; +$text['header-result']['ar-eg'] = ""; +$text['header-result']['de-at'] = ""; +$text['header-result']['de-ch'] = ""; +$text['header-result']['de-de'] = ""; +$text['header-result']['es-cl'] = ""; +$text['header-result']['es-mx'] = ""; +$text['header-result']['fr-ca'] = ""; +$text['header-result']['fr-fr'] = ""; +$text['header-result']['he-il'] = ""; +$text['header-result']['it-it'] = ""; +$text['header-result']['nl-nl'] = ""; +$text['header-result']['pl-pl'] = ""; +$text['header-result']['pt-br'] = ""; +$text['header-result']['pt-pt'] = ""; +$text['header-result']['ro-ro'] = ""; +$text['header-result']['ru-ru'] = ""; +$text['header-result']['sv-se'] = ""; +$text['header-result']['uk-ua'] = ""; + $text['description-emails']['en-us'] = "Manage failed email messages."; $text['description-emails']['ar-eg'] = ""; $text['description-emails']['de-at'] = "Fehlgeschlagene Email-Nachrichten verwalten."; //copied from de-de @@ -501,6 +561,66 @@ $text['description-emails']['ru-ru'] = "Управление ошибочным $text['description-emails']['sv-se'] = "Hantera misslyckade e-post meddelanden."; $text['description-emails']['uk-ua'] = ""; +$text['button-test']['en-us'] = "Test"; +$text['button-test']['ar-eg'] = ""; +$text['button-test']['de-at'] = ""; +$text['button-test']['de-ch'] = ""; +$text['button-test']['de-de'] = ""; +$text['button-test']['es-cl'] = ""; +$text['button-test']['es-mx'] = ""; +$text['button-test']['fr-ca'] = ""; +$text['button-test']['fr-fr'] = ""; +$text['button-test']['he-il'] = ""; +$text['button-test']['it-it'] = ""; +$text['button-test']['nl-nl'] = ""; +$text['button-test']['pl-pl'] = ""; +$text['button-test']['pt-br'] = ""; +$text['button-test']['pt-pt'] = ""; +$text['button-test']['ro-ro'] = ""; +$text['button-test']['ru-ru'] = ""; +$text['button-test']['sv-se'] = ""; +$text['button-test']['uk-ua'] = ""; + +$text['button-send']['en-us'] = "Send"; +$text['button-send']['ar-eg'] = ""; +$text['button-send']['de-at'] = ""; +$text['button-send']['de-ch'] = ""; +$text['button-send']['de-de'] = ""; +$text['button-send']['es-cl'] = ""; +$text['button-send']['es-mx'] = ""; +$text['button-send']['fr-ca'] = ""; +$text['button-send']['fr-fr'] = ""; +$text['button-send']['he-il'] = ""; +$text['button-send']['it-it'] = ""; +$text['button-send']['nl-nl'] = ""; +$text['button-send']['pl-pl'] = ""; +$text['button-send']['pt-br'] = ""; +$text['button-send']['pt-pt'] = ""; +$text['button-send']['ro-ro'] = ""; +$text['button-send']['ru-ru'] = ""; +$text['button-send']['sv-se'] = ""; +$text['button-send']['uk-ua'] = ""; + +$text['button-close']['en-us'] = "Close"; +$text['button-close']['ar-eg'] = ""; +$text['button-close']['de-at'] = ""; +$text['button-close']['de-ch'] = ""; +$text['button-close']['de-de'] = ""; +$text['button-close']['es-cl'] = ""; +$text['button-close']['es-mx'] = ""; +$text['button-close']['fr-ca'] = ""; +$text['button-close']['fr-fr'] = ""; +$text['button-close']['he-il'] = ""; +$text['button-close']['it-it'] = ""; +$text['button-close']['nl-nl'] = ""; +$text['button-close']['pl-pl'] = ""; +$text['button-close']['pt-br'] = ""; +$text['button-close']['pt-pt'] = ""; +$text['button-close']['ro-ro'] = ""; +$text['button-close']['ru-ru'] = ""; +$text['button-close']['sv-se'] = ""; +$text['button-close']['uk-ua'] = ""; + $text['button-resend']['en-us'] = "Resend"; $text['button-resend']['ar-eg'] = ""; $text['button-resend']['de-at'] = "Erneut senden"; //copied from de-de diff --git a/app/emails/email_test.php b/app/emails/email_test.php new file mode 100644 index 0000000000..4b4756ff99 --- /dev/null +++ b/app/emails/email_test.php @@ -0,0 +1,67 @@ +get(); + +if (valid_email($_POST['to'])) { + + $recipient = check_str($_POST['to']); + + echo "".$text['header-settings']."\n"; + echo "

\n"; + ksort($_SESSION['email']); + foreach ($_SESSION['email'] as $name => $setting) { + foreach ($setting as $type => $value) { + if ($type == 'uuid') { $uuid = $value; continue; } + if ($name == 'smtp_password') { $value = '[REDACTED]'; } + if (permission_exists('default_setting_edit')) { + echo "".$name.': '.$value."
\n"; + } + else { + echo $name.': '.$value."
\n"; + } + } + } + echo "

\n"; + + echo "".$text['header-connection']."\n"; + echo "

\n"; + + $eml_body = "Test Message

\n"; + $eml_body .= "This message is a test of the SMTP settings configured within your PBX.
\n"; + $eml_body .= "If you received this message, your current SMTP settings are valid.

\n"; + + ob_start(); + $sent = !send_email($recipient, 'Test Message', $eml_body, $eml_error) ? false : true; + $response = ob_get_clean(); + + echo $response; + + echo "

\n"; + + echo "".$text['header-result']."\n"; + echo "

\n"; + echo $sent ? "Message Sent Successfully
Receipient: ".$recipient."" : "Message Failed...
".$eml_error; + +} +else { + + echo "Error: Invalid Recipient Address"; + +} + +echo "
\n"; +echo "
\n"; +echo " \n"; +echo "
\n"; + +?> \ No newline at end of file diff --git a/app/emails/emails.php b/app/emails/emails.php index b961c48a96..2522c149f8 100644 --- a/app/emails/emails.php +++ b/app/emails/emails.php @@ -110,7 +110,52 @@ else { require_once "resources/header.php"; require_once "resources/paging.php"; +//styles + echo "\n"; + +//test result layer + echo "\n"; + //show the content + echo "
\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
"; @@ -119,6 +164,11 @@ else { echo " ".$text['description-emails']; echo " \n"; + echo " \n"; + echo " \n"; if (permission_exists('emails_all')) { if ($_REQUEST['showall'] != 'true') { echo " \n"; @@ -128,6 +178,7 @@ else { echo "
\n"; + echo "
\n"; echo "
\n"; //prepare to page the results @@ -264,6 +315,30 @@ else { echo ""; echo "

"; +//test script + echo "\n"; + //include the footer require_once "resources/footer.php"; ?> diff --git a/resources/functions.php b/resources/functions.php index 8c7aceb747..728e66b42b 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -1446,23 +1446,37 @@ function number_pad($number,$n) { $mail = new PHPMailer(); $mail -> IsSMTP(); + if ($_SESSION['email']['smtp_hostname']['text'] != '') { + $mail -> Hostname = $_SESSION['email']['smtp_hostname']['text']; + } $mail -> Host = $_SESSION['email']['smtp_host']['text']; - if ($_SESSION['email']['smtp_port']['text'] != '') { - $mail -> Port = $_SESSION['email']['smtp_port']['text']; + if (is_numeric($_SESSION['email']['smtp_port']['numeric'])) { + $mail -> Port = $_SESSION['email']['smtp_port']['numeric']; } if ($_SESSION['email']['smtp_auth']['text'] == "true") { $mail -> SMTPAuth = $_SESSION['email']['smtp_auth']['text']; - } - if ($_SESSION['email']['smtp_username']['text']) { $mail -> Username = $_SESSION['email']['smtp_username']['text']; $mail -> Password = $_SESSION['email']['smtp_password']['text']; } + else { + $mail -> SMTPAuth = 'false'; + } if ($_SESSION['email']['smtp_secure']['text'] == "none") { $_SESSION['email']['smtp_secure']['text'] = ''; } if ($_SESSION['email']['smtp_secure']['text'] != '') { $mail -> SMTPSecure = $_SESSION['email']['smtp_secure']['text']; } + if (isset($_SESSION['email']['smtp_validate_certificate']) && $_SESSION['email']['smtp_validate_certificate']['boolean'] == "false") { + // bypass TLS certificate check e.g. for self-signed certificates + $mail -> SMTPOptions = array( + 'ssl' => array( + 'verify_peer' => false, + 'verify_peer_name' => false, + 'allow_self_signed' => true + ) + ); + } $eml_from_address = ($eml_from_address != '') ? $eml_from_address : $_SESSION['email']['smtp_from']['text']; $eml_from_name = ($eml_from_name != '') ? $eml_from_name : $_SESSION['email']['smtp_from_name']['text']; $mail -> SetFrom($eml_from_address, $eml_from_name); @@ -1470,6 +1484,7 @@ function number_pad($number,$n) { $mail -> Subject = $eml_subject; $mail -> MsgHTML($eml_body); $mail -> Priority = $eml_priority; + $mail -> SMTPDebug = 3; $address_found = false;