Jump to content


Photo

email script


  • Please log in to reply
22 replies to this topic

#21 Ravi Kumar

Ravi Kumar
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 13 September 2006 - 08:22 AM

HI All

I am facing the same problem.
Form my PHP code I am able to send mail to some domains except yahoo,gmail and etc.......

I searched in the forum and found a few threads.But none of them has final solution.

please find the below code.

<?php

 ini_set("display_errors", "1");
 ini_set("error_reporting", "E_ALL");

 $headers  = "From: "     . "ravi.kotha@domain.com" . "\n";
 $headers .= "Reply-To: " . "ravi.kotha@domain.com". "\n";
 $headers .= "Cc: "       . "ravi_1201@yahoo.com"   . "\n";
 $headers .= "Bcc: "      . "ravikumar.kotha@gmail.com"  . "\n";

 $message = "message content";

 $subject = "working on mailing functionality";

 $to      = "ravi.kotha@domain.com,anantharavi@yahoo.co.in";

 $flag    = mail($to,$subject,$message,$headers);

 print "flag is $flag";
?>


Please let me know the solution.
Appreciate your help.

thanks
Ravi Kumar

#22 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 13 September 2006 - 09:00 AM

and me also found the same problem with mail method (not send )
if any one know any good code used and explian wat is the popular wrong to help us (mail and form)


#23 wholein1

wholein1
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 14 September 2006 - 02:09 PM

I have found this to work the best for me. I am going to try and test your code on mine and see if it works for me. I will let you know what comes of it. Below will work with any html form.


<?php
  if ($_SERVER['REQUEST_METHOD']=="POST"){
      // In testing, if you get an Bad referer error
      // comment out or remove the next three lines
   
      foreach($_POST as $key => $val){
        if (is_array($val)){
            $msg.="Item: $key\n";
            foreach($val as $v){
              $v = stripslashes($v);
              $msg.="  $v\n";
            }
        } else {
            $val = stripslashes($val);
            $msg.="$key: $val\n";
        }
      }
      $recipient="administration@cafeexpress-o.com";
      $subject="Form submission Cafe Express-O";
      error_reporting(0);
      if (mail($recipient, $subject, $msg)){
        echo "<h1>Thank you</h1><p>Message successfully was sent to Cafe Express-O.
</p><p>We will respond to you as soon as possible.</p>\n";
        echo nl2br($input);
      } else
        echo "An error occurred and the message could not be sent.";
  } else
      echo "Bad request method";
?>

I hope this helps

Jeff




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users