Page 1 of 1

problems with mail()

Posted: Thu Jan 30, 2003 4:48 pm
by matthiasone
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:

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();
}

Posted: Fri Jan 31, 2003 3:27 am
by twigletmac
Did they change the version of PHP on the server, or adjust any configuration variables? If they did then this is most likely the problem:
viewtopic.php?t=511

Mac

Posted: Fri Jan 31, 2003 9:35 am
by matthiasone
they upgraded from PHP 4.1.2 to PHP 4.2.2. Global Variables is on and the only script affected is the mail script. I created a test script and placed strings for all parameters and got the same results.