diff --git a/lib/phpmailer/moodle_phpmailer.php b/lib/phpmailer/moodle_phpmailer.php index d386ab6c67c..eda2afd7d51 100644 --- a/lib/phpmailer/moodle_phpmailer.php +++ b/lib/phpmailer/moodle_phpmailer.php @@ -128,7 +128,7 @@ class moodle_phpmailer extends PHPMailer { protected function PostSend() { // Now ask phpunit if it wants to catch this message. - if (phpunit_util::is_redirecting_messages()) { + if (PHPUNIT_TEST && phpunit_util::is_redirecting_messages()) { $mail = new stdClass(); $mail->header = $this->MIMEHeader; $mail->body = $this->MIMEBody;