problems with mail()
Posted: Thu Jan 30, 2003 4:48 pm
I have a script that work until the middle of Dec when it suddenly stopped working. I didn't change the script so I think it has something to do with the server or PHP running in the server. The script appears to work...no errors are given, but the message never arrives. I am using PEAR to send the mail. As for as I can tell the server is running correctly, and currently running PHP 4.2.2. The site is hosted on pair.com. They aren't much help because this is a custom script, so they assume it is a error in the script. I do know of an other person on pair.com who had the same problem about the same time.
Here is the code I use:
Here is the code I use:
Code: Select all
function sendemail_form($form_vars, $source)
{
require_once("Mail.php");
if($source == "p")
{
$addy = "prayer@lufkin.org";
}
if($source == "w")
{
$addy = "webmaster@lufkin.org";
}
if($source == "m")
{
$query = "SELECT * FROM mindefaults WHERE ministry = ".$form_varsї"recipients"];
$result = query_db($query);
if (! $result)
die("No Results");
$ministry = mysql_fetch_array($result);
$addy = $ministryї"email"];
}
if($source == "s")
{
$query = "SELECT * FROM staffinfo WHERE staffid = ".$form_varsї"recipients"];
$result = query_db($query);
if (! $result)
die("No Results");
$staffmember = mysql_fetch_array($result);
$addy = $staffmemberї"email"];
}
$recipients = $addy;
$headersї'From'] = $form_varsї"from"];
$headersї'To'] = $form_varsї"recipients"];
$headersї'Subject'] = "%^ - ".$form_varsї"subject"];
$body = $form_varsї"body"];
$paramsї'host'] = 'mail.lufkin.org';
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('smtp', $params);
$mail_object->send($recipients, $headers, $body);
do_sentpage();
}