Add debug option to output e-mail on screen. Useful for testing that mails look correct.

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-04-23 23:36:32 +00:00
committed by WineHQ
parent b18a91cca7
commit fa050164f7
2 changed files with 17 additions and 0 deletions

View File

@@ -23,6 +23,12 @@ define("BUGZILLA_ROOT","http://bugs.winehq.org/"); // path to bugzilla
//if(!defined("DISABLE_EMAIL")) //if(!defined("DISABLE_EMAIL"))
// define("DISABLE_EMAIL", true); // disable email, see mail_appdb() in include/mail.php // 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 * apps database info
*/ */

View File

@@ -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 .= "\n\nIf you don't want to receive any other e-mail, please change your preferences:\n";
$sMsg .= APPDB_ROOT."preferences.php\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", "<br />", $sMsg);
addmsg("This mail would have been sent<br /><br />".
"Subject: $sSubject<br /><br />".
"Body:<br />$sMsg", "purple");
return;
}
$bResult = mail(str_replace(" ",",",$sEmailList), "[AppDB] ".$sSubject, $sMsg, $sHeaders, "-f".APPDB_OWNER_EMAIL); $bResult = mail(str_replace(" ",",",$sEmailList), "[AppDB] ".$sSubject, $sMsg, $sHeaders, "-f".APPDB_OWNER_EMAIL);
if($bResult) if($bResult)
addmsg("Message sent to: ".$sEmailList, "green"); addmsg("Message sent to: ".$sEmailList, "green");