Hey all, FYI - I'm not a PHP guy but I am usually able to figure things out. I downloaded a template for a website. Everything is great except for the email for submit. I keep getting an error while trying to send. If you want to see the error in action, go to www.craigfisherlive.com and click on the "contact me" page and try to use the form. You'll see exactly what's going on. The PHP code for the contact pape looks like this: <?PHP $to = "fishercraigj@gmail.com"; $subject = "www.craigfisherlive.com"; $e = $_POST['email_txt']; $message = "Name: " . $_POST['name_txt']; $message .= "\nE-mail: " . $e; $message .= "\nPhone: " . $_POST['phone_txt']; $message .= "\n\nMessage: " . $_POST['message_txt']; $headers = "From: $e"; $headers .= "\nReply-To: $e"; $sentOk = mail($to,$subject,$message,$headers); echo "sentOk=" . $sentOk; ?> Can anyone sniff out why my form isn't working? I'd be very much appreciative. Feel free to email me back at fishercraigj@gmail.com Thanks! Craig
hi fishercraigj, I checked your code in my server it sending mail perfectly and no error. I checked these in linux server.
Well fisher i can tell you there is no problem with that code. Im persuming you are using ajax. So i can tell there is a problem with that not the PHP Code that you put above.
Well, I've figured out that it's not a server problem...so that's good at least. 3zzy - I went to the link that you sent and it suggest that I use this example: <?php $to = "fishercraigj@gmail.com"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> My original code is: <?PHP $to = "fishercraigj@gmail.com"; $subject = "CraigFisherLive"; $e = $_POST['email_txt']; $message = "Name: " . $_POST['name_txt']; $message .= "\nE-mail: " . $e; $message .= "\nPhone: " . $_POST['phone_txt']; $message .= "\n\nMessage: " . $_POST['message_txt']; $headers = "From: $e"; $headers .= "\nReply-To: $e"; $sentOk = mail($to,$subject,$message,$headers); echo "sentOk=" . $sentOk; ?> I'm not a php developer at all so taking my code (came with the template) over to the example that you're showing me, how should it be written? Thanks all for the help on this, Craig
I'll take a stab though....is this right? If so, it's still not working. <?php $to = "fishercraigj@gmail.com"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $message = "Name: " . $_POST['name_txt']; $message .= "\nE-mail: " . $e; $message .= "\nPhone: " . $_POST['phone_txt']; $message .= "\n\nMessage: " . $_POST['message_txt']; $headers = "From: $e"; $headers .= "\nReply-To: $e"; $sentOk = mail($to,$subject,$message,$headers); if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> I've attached my flash contact page along with the php files in a zip. I'm about 99.9999% sure that the Actionscript is fine but maybe something is wrong with the Actionscript and I'm just missing it. PS - If someone helps me solve this, the favor will not go unrecognized. I've got a ton of software (the good stuff) that I'd be willing to help YOU out with. Just my way of returning the favor.
You're sending the mail twice or will be once you get it to work. Maybe the line feeds is the problem. Also, $body isn't used >? Did you mean to add it to $message? Try this. Replace the last part of your script with this: $headers = "From: $e \r\n"; $headers .= "Reply-To: $e"; $sentOk = mail($to,$subject,$message,$headers); if ($sentOk) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } Code (markup): Basics of php email and more here : http://webcheatsheet.com/php/send_email_text_html_attachment.php