Skip to content

Commit dc40efe

Browse files
authored
add option to force test emails to always go to the same address (#1068)
1 parent 74f335f commit dc40efe

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

public_html/lists/admin/send_core.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,11 @@
461461
include 'sendemaillib.php';
462462

463463
// OK, let's get to sending!
464-
$emailaddresses = explode(',', $messagedata['testtarget']);
464+
if (defined('TEST_EMAIL_ALWAYS_TO') && TEST_EMAIL_ALWAYS_TO) {
465+
$emailaddresses = array(TEST_EMAIL_ALWAYS_TO);
466+
} else {
467+
$emailaddresses = explode(',', $messagedata['testtarget']);
468+
}
465469
if (count($emailaddresses) > SENDTEST_MAX) {
466470
foreach ($GLOBALS['plugins'] as $plname => $plugin) {
467471
$plugin->processError('Send test capped from '.count($emailaddresses).' to '.SENDTEST_MAX);
@@ -983,7 +987,19 @@
983987
</span>
984988
</div>
985989
</div>';
986-
990+
991+
if (defined('TEST_EMAIL_ALWAYS_TO') && TEST_EMAIL_ALWAYS_TO) {
992+
$sendtest_content = '<div class="sendTest" id="sendTest">
993+
' .$sendtestresult.Help('sendtest').' <b>'.s('to email address(es)').':</b><br />'.
994+
'<p><i>&nbsp; '.s('All test emails will go to %s',TEST_EMAIL_ALWAYS_TO).'</i></p>'.
995+
'<div class="input-group">
996+
<input type="hidden" name="testtarget" value="'.htmlspecialchars(TEST_EMAIL_ALWAYS_TO).'" />
997+
<span class="input-group-btn">
998+
<input class="submit btn btn-primary" type="submit" name="sendtest" value="' .s('Send Test').'" />
999+
</span>
1000+
</div>
1001+
</div>';
1002+
}
9871003
// notification of progress of message sending
9881004
// defaulting to admin_details['email'] gives the wrong impression that this is the
9891005
// value in the database, so it is better to leave that empty instead

public_html/lists/config/config_extended.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,10 @@
530530
// test emails are sent to
531531
define('SEND_ONE_TESTMAIL', 0);
532532

533+
// test emails
534+
// with this setting you can ensure that test emails are always sent to the same email address
535+
define('TEST_EMAIL_ALWAYS_TO',false);
536+
533537
// send a webpage. You can send the contents of a webpage, by adding
534538
// [URL:http://website/file.html] as the content of a message. This can also be personalised
535539
// for users by using eg

0 commit comments

Comments
 (0)