I've noticed a few posts on the board about people having problems trying send mail on NT systems using PHP. Below, you will find a script that uses CDO on Windows 2000 to send mail. It should work on NT4 if CDO is installed. All I ask is that you please hack good sendmail function for PHP, give me credit in your function's header, and send it back to me. I'd create a sendmail function, but I have no time. Good luck dear programmer.
function sendReport($sMessage){
$sFrom ="santa@earlclaus.com";
$sToPHP ="santa@earlclaus.com";
$sToNT ="santa@earlclaus.com;";
$sSubject ="IRBS : script Failed.";
$sBody =$sMessage;
if(getenv("OS")!="Windows_NT")
{
echo "Running non-NT-enhanced calls";
mail($sFrom, $sSubject, $sBody, "From: $sFrom\nReply-To: $sToPHP\nX-Mailer: PHP/" . phpversion()) or die("/nCannot send mail from non-NT system./n/n");
}else{
echo "Running NT-enhanced calls";
// mail constants (some are for reference)
$CdoBodyFormatHTML = 0; // Body property is HTML
$CdoBodyFormatText = 1; // Body property is plain text (default)
$CdoMailFormatMime = 0; // NewMail object is in MIME format
$CdoMailFormatText = 1; // NewMail object is plain text (default)
$CdoLow = 0; // Low importance
$CdoNormal = 1; // Normal importance (default)
$CdoHigh = 2; // High importance
$cBodyFormat =$CdoBodyFormatText;
$cCdoMailFormat =$CdoMailFormatText;
$cCdoImportance =$CdoHigh;
$objEMail = new COM("CDONTS.NewMail");
$objEMail->From = $sFrom;
$objEMail->To = $sToNT;
$objEMail->Subject = $sSubject;
$objEMail->Body = $sBody;
$objEMail->BodyFormat = $cBodyFormat;
$objEMail->MailFormat = $cCdoMailFormat;
$objEMail->Importance = $cCdoImportance;
$objEMail->Send();
$objEMail = "";
}
}
Keywords for this search engine: howto send mail on NT, CDO, mail , mail on NT fails, sendmail on NT, CDONTS