diff --git a/app/email_queue/email_test.php b/app/email_queue/email_test.php
index e7ce95b38f..257436c3cd 100644
--- a/app/email_queue/email_test.php
+++ b/app/email_queue/email_test.php
@@ -41,9 +41,41 @@
//prepare the email
$email_recipient = !empty($_POST['to']) && valid_email($_POST['to']) ? strtolower($_POST['to']) : null;
- $email_body = "Test Message
\n";
- $email_body .= "This message is a test of the SMTP settings configured within your PBX.
\n";
- $email_body .= "If you received this message, your current SMTP settings are valid.
\n";
+//retrieve email template
+ $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
+ $language_dialect = $settings->get('domain', 'language', 'en-us');
+ if (!empty($language_dialect)) {
+ $sql = "select ";
+ $sql .= " template_subject, ";
+ $sql .= " template_body ";
+ $sql .= "from ";
+ $sql .= " v_email_templates ";
+ $sql .= "where ";
+ $sql .= " template_language = :template_language ";
+ $sql .= " and template_category = 'email' ";
+ $sql .= " and template_subcategory = 'test' ";
+ $sql .= " and template_type = 'html' ";
+ $sql .= " and template_enabled = 'true' ";
+ $sql .= " and (domain_uuid = :domain_uuid or domain_uuid is null) ";
+ $sql .= "limit 1 ";
+ $parameters['template_language'] = $language_dialect;
+ $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
+ $database = new database;
+ $template = $database->select($sql, $parameters, 'row');
+ unset($sql, $parameters);
+ }
+//use email template
+ if (!empty($template) && (!empty($template['template_body']) || !empty($template['template_body']))) {
+ $email_subject = $template['template_subject'];
+ $email_body = $template['template_body'];
+ }
+//no template found, use default message
+ else {
+ $email_subject = 'Test Message';
+ $email_body = "Test Message
\n";
+ $email_body .= "This message is a test of the SMTP settings configured within your PBX.
\n";
+ $email_body .= "If you received this message, your current SMTP settings are valid.
\n";
+ }
$email_from_address = $_SESSION['email']['smtp_from']['text'];
$email_from_name = $_SESSION['email']['smtp_from_name']['text'];
@@ -52,7 +84,7 @@
$sent = 0;
$email = new email;
$email->recipients = $email_recipient;
- $email->subject = 'Test Message';
+ $email->subject = $email_subject;
$email->body = $email_body;
$email->from_address = $email_from_address;
$email->from_name = $email_from_name;
diff --git a/core/email_templates/app_defaults.php b/core/email_templates/app_defaults.php
index 47f422f0ee..9c81711e00 100644
--- a/core/email_templates/app_defaults.php
+++ b/core/email_templates/app_defaults.php
@@ -544,6 +544,24 @@
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_description'] = '';
+ $x++;
+
+ $array['email_templates'][$x]['email_template_uuid'] = '54616982-68ae-4e55-99f4-e45ffa68e379';
+ $array['email_templates'][$x]['template_language'] = 'en-us';
+ $array['email_templates'][$x]['template_category'] = 'email';
+ $array['email_templates'][$x]['template_subcategory'] = 'test';
+ $array['email_templates'][$x]['template_subject'] = 'Test Message';
+ $array['email_templates'][$x]['template_body'] = "\n";
+ $array['email_templates'][$x]['template_body'] .= "