problems with mail()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

problems with mail()

Post 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();
}
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post 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.
Post Reply