Jump to content


Photo

mail() function


  • Please log in to reply
1 reply to this topic

#1 jrodd32

jrodd32
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 13 October 2006 - 03:53 PM

I am trying to send mail automatically within my form.  I have read the php manual and it says that it will display errors if there is a problem with the function.  However, I am getting no errors and no emails.


<?php
while($row = mysql_fetch_assoc($officialslist))
  {
   if(($ID==$row[id])&&($SSWEB==$row[SSWEB]))
   {
    if(($sport == 'BA')||($sport == 'FB')||($sport == 'TR')||($sport == 'WR'))
      {
        $to='user1@webmail.khsaa.org,user2@webmail.khsaa.org,user3@webmail.khsaa.org';
        foreach($source as $concern)
          $subject=$concern;
        $message="<br>
	$explaination
        <br>
        $row[id];
        <br>
        $row[lname].$row[suffix].', '.$row[fname];
        <br>
        $row[homephone];
        <br>
        $row[workphone];
        <br>
        $row[email]";
        $headers='X-Mailer: PHP/' .phpversion();
        mail($to, $subject, $message, $headers);
      }
    if(($sport == 'BK')||($sport == 'VB'))
      {
        $to='user1@webmail.khsaa.org,user2@webmail.khsaa.org,user3@webmail.khsaa.org';
        foreach($source as $concern)
          $subject=$concern;
        $message="<br>
	$explaination
        <br>
        $row[id];
        <br>
        $row[lname].$row[suffix].', '.$row[fname];
        <br>
        $row[homephone];
        <br>
        $row[workphone];
        <br>
        $row[email]";
        $headers='From: $row[email]' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
        mail($to, $subject, $message, $headers);
      }
    if(($sport == 'SO')||($sport == 'SW')||($sport == 'SP')||($sport == 'FP'))
      {
        $to='user1@webmail.khsaa.org,user2@webmail.khsaa.org,user3@webmail.khsaa.org';
        foreach($source as $concern)
          $subject=$concern;
        $message="<br>
	$explaination
        <br>
        $row[id];
        <br>
        $row[lname].$row[suffix].', '.$row[fname];
        <br>
        $row[homephone];
        <br>
        $row[workphone];
        <br>
        $row[email]";
        $headers='X-Mailer: PHP/' .phpversion();
        mail($to, $subject, $message, $headers);
      }
    }
  else
   $row=mysql_fetch_assoc($officialslist);
   }
?>


#2 xsist10

xsist10
  • Members
  • PipPipPip
  • Advanced Member
  • 114 posts

Posted 13 October 2006 - 04:08 PM

Are you running on a windows or linux machine...

the mail() function calls an external function (based on the settings in php.ini). You still need to have the external program installed (such as sendmail, etc).

see http://www.php.net/mail
SA PHP Archives - www.phparchives.za.org




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users