send emails in php not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We recently moved to a new server. Our code that would send out emails is no longer sending emails.
There are no messages in the httpd logs associated with running the email.php files.
The email scripts worked on the old server. Is there a special setting in php.ini for sending emails in php or is there a packages that needs to be installed on the new server. Below is some sample code that worked on the old server

Receive the email request:
  1 <html>
  2 <body>
  3
  4 <form action="emailFormProcess.php" method="post">
  5 Your Name: <input type="text" name="name"><br>
  6 E-mail: <input type="text" name = "email"><br><br>
  7 Comments<br>
  8 <textarea name="comments"></textarea><br><br>
  9 <input type="submit" value="Submit">
 10 </form>
 11
 12 </body>
 13 </html>

Process the email request:
  1 <html>
  2 <body>
  3
  4 <?
  5 function checkOK($field)
  6 {
  7 if (eregi("\r",$field) || eregi("\n",$field)){
  8 die("Invalid Input!");
  9 }
 10 }
 11
 12 $name=$_POST['name'];
 13 checkOK($name);
 14 $email=$_POST['email'];
 15 checkOK($email);
 16 $comments=$_POST['comments'];
 17 checkOK($comments);
 18 $to="Marc.Fromm@xxxxxxx,$email";
 19 $message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address iss    : $email";
 20 if(mail($to,"Comments From Your Site",$message,"From: $email\n")) {
 21 echo "Thanks for your comments.";
 22 } else {
 23 echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
 24 }
 25 ?>
 26
 27 </html>
 28 </body>

Thanks

Marc


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux