diff --git a/include/config.php.sample b/include/config.php.sample index 81beba9..13c4751 100644 --- a/include/config.php.sample +++ b/include/config.php.sample @@ -23,6 +23,12 @@ define("BUGZILLA_ROOT","http://bugs.winehq.org/"); // path to bugzilla //if(!defined("DISABLE_EMAIL")) // define("DISABLE_EMAIL", true); // disable email, see mail_appdb() in include/mail.php +// AppDB developers: Use this define to print the contents of the e-mail instead +// of sending it, useful for testing e-mail notifications. Has no effect if +// DISABLE_EMAIL is set +//if(!defined("PRINT_EMAIL")) +// define("PRINT_EMAIL", true); // print email, see mail_appdb() in include/mail.php + /* * apps database info */ diff --git a/include/mail.php b/include/mail.php index d580bfe..f4c4d44 100644 --- a/include/mail.php +++ b/include/mail.php @@ -21,6 +21,17 @@ function mail_appdb($sEmailList,$sSubject,$sMsg) $sMsg .= "\n\nIf you don't want to receive any other e-mail, please change your preferences:\n"; $sMsg .= APPDB_ROOT."preferences.php\n"; + /* Print the message to the screen instead of sending it, if the PRINT_EMAIL + option is set. Output in purple to distinguish it from other messages */ + if(defined("PRINT_EMAIL")) + { + $sMsg = str_replace("\n", "
", $sMsg); + addmsg("This mail would have been sent

". + "Subject: $sSubject

". + "Body:
$sMsg", "purple"); + return; + } + $bResult = mail(str_replace(" ",",",$sEmailList), "[AppDB] ".$sSubject, $sMsg, $sHeaders, "-f".APPDB_OWNER_EMAIL); if($bResult) addmsg("Message sent to: ".$sEmailList, "green");