diff --git a/pub/api/classes/API_mailsettings.php b/pub/api/classes/API_mailsettings.php
index 3fb87b0..c08278b 100644
--- a/pub/api/classes/API_mailsettings.php
+++ b/pub/api/classes/API_mailsettings.php
@@ -6,6 +6,7 @@ use api\classes\API;
require_once 'API.php';
+
class API_mailsettings extends API
{
public function updateMailSettings($updatePassword)
@@ -27,4 +28,19 @@ class API_mailsettings extends API
}
}
+
+ public function testSendMail($mailBuilder)
+ {
+
+ $mailBuilder->subject = "Test mail";
+ $mailBuilder->addAddress($this->data['mail_to'], $this->data['mail_to']);
+ $mailBuilder->mailText = '
+Hello,
+
+This is a test email sent through Sentri.
+
+If you received this email, your Sentri mail settings are configured correctly.
+';
+ $mailBuilder->sendMail();
+ }
}
diff --git a/pub/api/v1/portal-management/mail/test/index.php b/pub/api/v1/portal-management/mail/test/index.php
new file mode 100644
index 0000000..a38d80d
--- /dev/null
+++ b/pub/api/v1/portal-management/mail/test/index.php
@@ -0,0 +1,30 @@
+request_method === 'POST') {
+ # Send a test email to an address
+
+ $API_mailsettings->checkPermissions('admin-mailsettings', 'RO');
+
+ $requiredFields = [
+ 'mail_to' => ['type' => 'email'],
+ ];
+
+ $API_mailsettings->validateData($requiredFields);
+
+ # Send the test email
+ $mailBuilder = new mailBuilder();
+ $API_mailsettings->testSendMail($mailBuilder);
+
+ $API_mailsettings->apiOutput(200, ['success' => 'The test email was sent.']);
+}
+
+
diff --git a/pub/bin/locales/en.php b/pub/bin/locales/en.php
index 1045c43..0a3c7c6 100644
--- a/pub/bin/locales/en.php
+++ b/pub/bin/locales/en.php
@@ -218,6 +218,10 @@ return [
'mfa_disabled' => 'Two factor authentication is disabled.',
'send_password_reset' => 'Send password reset email',
'email_send' => 'Email sent',
+ 'send_test_mail' => 'Send test email',
+ 'send_test_mail_explanation' => 'This test will send an email to the given email address.',
+ 'send_mail' => 'Sent',
+ 'mail_to' => 'Mail to',
'api_token_created' => 'API token created',
'permission_created' => 'Permission created',
'permission_updated' => 'Permission updated',
@@ -242,6 +246,7 @@ return [
'inserve_url' => 'Inserve URL',
'inserve_source' => 'Inserve Configuration',
'test_connection' => 'Test Connection',
+ 'test' => 'Test',
'connection_success_title' => 'Successful',
'connection_success_text' => 'Connection made successful',
'connection_error_title' => 'Error',
diff --git a/pub/bin/locales/nl.php b/pub/bin/locales/nl.php
index 69f682f..382a844 100644
--- a/pub/bin/locales/nl.php
+++ b/pub/bin/locales/nl.php
@@ -218,6 +218,10 @@ return [
'mfa_disabled' => 'Two factor authenticatie is uitgeschakeld',
'send_password_reset' => 'Wachtwoord herstel e-mail versturen',
'email_send' => 'Verstuur e-mail',
+ 'send_test_mail' => 'Verstuur test e-mail',
+ 'send_test_mail_explanation' => 'Deze test verstuurd een e-mail naar het opgegeven adres.',
+ 'send_mail' => 'Verstuur',
+ 'mail_to' => 'Mail naar',
'api_token_created' => 'API token toegevoegd',
'permission_created' => 'Permission aangemaakt',
'permission_updated' => 'Permission bijgewerkt',
@@ -242,6 +246,7 @@ return [
'inserve_url' => 'Inserve URL',
'inserve_source' => 'Inserve Configuratie',
'test_connection' => 'Test Connectie',
+ 'test' => 'Test',
'connection_success_title' => 'Success',
'connection_success_text' => 'Connectie succesvol',
'connection_error_title' => 'Error',
diff --git a/pub/bin/pages/portal-management/pageSystemConfig.php b/pub/bin/pages/portal-management/pageSystemConfig.php
index 8eb0907..d8b28f1 100644
--- a/pub/bin/pages/portal-management/pageSystemConfig.php
+++ b/pub/bin/pages/portal-management/pageSystemConfig.php
@@ -244,6 +244,9 @@ while ($module = $system_modules_data->fetch_assoc()) {