diff --git a/app/email_logs/email_test.php b/app/email_logs/email_test.php index 534ef9c0af..3dcf600633 100644 --- a/app/email_logs/email_test.php +++ b/app/email_logs/email_test.php @@ -1,67 +1,88 @@ + Portions created by the Initial Developer are Copyright (C) 2008-2019 + the Initial Developer. All Rights Reserved. + Contributor(s): + Mark J Crane +*/ -if (!permission_exists('email_view')) { - echo "access denied"; - exit; -} +//includes + require_once "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (!permission_exists('email_log_view')) { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; $text = $language->get(); -if (valid_email($_POST['to'])) { +//send email + if (valid_email($_POST['to'])) { - $recipient = check_str($_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 "".$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, null, null, 3, 3) ? 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 "".$text['header-connection']."\n"; - echo "

\n"; + echo "
\n"; + echo "
\n"; + echo " \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, null, null, 3, 3) ? 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 +?>