• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Whitelist of emails to still send to even with $config['enableMail'] on

Jake B.

Well-known member
If there was a way I could do something like this:

$config['enableMail'] = false;
$config['enableMail']['whitelist'] = [
and it'll still send email to the users specified that'd enable testing emails after an import without accidentally having things sent incorrectly

Chris D

XenForo developer
Staff member
For mail testing, regardless of the scenario, I'd recommend one of two things.

1. File transport

This lets you trap all mails and have them written out to the file system. Just add the following to config.php:
/** @var $c \XF\Container */
$c->extend('mailer', function(\XF\Mail\Mailer $mailer)
    $transport = \XF\Mail\Mailer::getTransportFromOption('file', [
        'path' => \XF::getRootDirectory() . '/internal_data'
    return $mailer;
2. MailTrap.io

My personal favourite. This is a special SMTP server you can use and will make all of the emails you send in their webmail like interface. You can actually set it all up in the config.php file too similar to the above.

File transport is probably the easiest. Can do a similar config.php approach in XF1 too:
$transport = new Zend_Mail_Transport_File([
    'path' => XenForo_Helper_File::getInternalDataPath()