aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorZoddo <zoddo.ino@gmail.com>2015-08-30 18:56:19 +0200
committerZoddo <zoddo.ino@gmail.com>2015-09-09 17:51:14 +0200
commit57cb7e41111b272de1fa01696a2652095c9a573d (patch)
tree03a6a6fdc474cde03d3bb2bcc40c2f2c50a2b6af /phpBB
parent2c188f22d007479477a2f5ede15a2067c7cd2242 (diff)
downloadforums-57cb7e41111b272de1fa01696a2652095c9a573d.tar
forums-57cb7e41111b272de1fa01696a2652095c9a573d.tar.gz
forums-57cb7e41111b272de1fa01696a2652095c9a573d.tar.bz2
forums-57cb7e41111b272de1fa01696a2652095c9a573d.tar.xz
forums-57cb7e41111b272de1fa01696a2652095c9a573d.zip
[ticket/10165] Add a "Send test email" feature
PHPBB3-10165
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/acp/acp_board.php29
-rw-r--r--phpBB/language/en/acp/board.php3
-rw-r--r--phpBB/language/en/email/test.txt9
3 files changed, 41 insertions, 0 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 6e636d2f7d..5a0ede1de3 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -448,6 +448,7 @@ class acp_board
'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true),
'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true),
'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'send_test_email' => array('lang' => 'SEND_TEST_EMAIL', 'validate' => 'bool', 'type' => 'custom', 'method' => 'send_test_email', 'explain' => true),
'legend2' => 'SMTP_SETTINGS',
'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
@@ -631,6 +632,27 @@ class acp_board
}
}
+ if ($mode == 'email' && $request->is_set_post('send_test_email'))
+ {
+ if ($config['email_enable'])
+ {
+ include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+
+ $messenger = new messenger(false);
+ $messenger->template('test');
+ $messenger->set_addresses($user->data);
+ $messenger->anti_abuse_headers($config, $user);
+ $messenger->send(NOTIFY_EMAIL);
+
+ trigger_error($user->lang('TEST_EMAIL_SENT') . adm_back_link($this->u_action));
+ }
+ else
+ {
+ $user->add_lang('memberlist');
+ trigger_error($user->lang('EMAIL_DISABLED') . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ }
+
if ($submit)
{
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode));
@@ -1139,4 +1161,11 @@ class acp_board
return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) .
($message !== false ? '<br /><span>' . $user->lang($message) . '</span>' : '');
}
+
+ function send_test_email($value, $key)
+ {
+ global $user;
+
+ return '<input class="button2" type="submit" id="' . $key . '" name="' . $key . '" value="' . $user->lang['SEND_TEST_EMAIL'] . '" />';
+ }
}
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 001775349a..2778ce75eb 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -559,6 +559,8 @@ $lang = array_merge($lang, array(
'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.',
'ENABLE_EMAIL' => 'Enable board-wide emails',
'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. <em>Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will disable registration.</em>',
+ 'SEND_TEST_EMAIL' => 'Send a test email',
+ 'SEND_TEST_EMAIL_EXPLAIN' => 'This will send a test email to the address defined in your account.',
'SMTP_AUTH_METHOD' => 'Authentication method for SMTP',
'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.',
'SMTP_CRAM_MD5' => 'CRAM-MD5',
@@ -574,6 +576,7 @@ $lang = array_merge($lang, array(
'SMTP_SETTINGS' => 'SMTP settings',
'SMTP_USERNAME' => 'SMTP username',
'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your SMTP server requires it.',
+ 'TEST_EMAIL_SENT' => 'The test email has been sent.',
'USE_SMTP' => 'Use SMTP server for email',
'USE_SMTP_EXPLAIN' => 'Select “Yes” if you want or have to send email via a named server instead of the local mail function.',
));
diff --git a/phpBB/language/en/email/test.txt b/phpBB/language/en/email/test.txt
new file mode 100644
index 0000000000..91a737248b
--- /dev/null
+++ b/phpBB/language/en/email/test.txt
@@ -0,0 +1,9 @@
+Subject: phpBB is correctly configured to send emails
+
+Hello {USERNAME},
+
+Congratulations. If you received this email, phpBB is correctly configured to send emails.
+
+In case you require assistance, please visit the phpBB support forums - https://www.phpbb.com/community/
+
+{EMAIL_SIG}