Xelex Posted November 24, 2008 Share Posted November 24, 2008 I did some searching, but I can't seem to find the answer to my problem... I wrote a contact form in PHP, and on LunarPages servers, it runs just fine. However, when I try to run it on Yahoo servers, I get an error, though it doesn't give me a reason. I'm assuming it's because Yahoo has a safeguard in place to prevent people from spamming through contact forms. But my question is, how do I make a PHP script send an email from my domain's email address? Here's my script at present: <?php if (isset($_POST["email"])) { $ToEmail = '***********.com' . ', '; $ToEmail .= '**********.com'; $EmailSubject = 'Site Contact Form '; $mailheader = "From: ".$_POST["email"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "\nFirst Name: ".$_POST["name"]."<br>"; $MESSAGE_BODY .= "\nLast Name: ".$_POST["name2"]."<br>"; $MESSAGE_BODY .= "\nAffilliation/Convention: ".$_POST["name3"]."<br>"; $MESSAGE_BODY .= "\nHome Phone Number: ".$_POST["name4"]."<br>"; $MESSAGE_BODY .= "\nCell Phone Number: ".$_POST["name5"]."<br>"; $MESSAGE_BODY .= "\nWork Phone Number: ".$_POST["name6"]."<br>"; $MESSAGE_BODY .= "\nDates for Rental: ".$_POST["name7"]."<br>"; $MESSAGE_BODY .= "\nType of Equipment: ".$_POST["FieldData"]."<br>"; $MESSAGE_BODY .= "\nEmail Address: ".$_POST["email"]."<br>"; $MESSAGE_BODY .= "\nAdditional Comments: ".nl2br($_POST["comment"])."<br>"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure. Again!"); ?> <b>Your message was sent to one of our representatives, and will be reviewed. We look forward to contacting you in the near future, thank you.</b> <?php } else { ?> Once again, it works just fine on Lunarpages, (When I get the email, it comes straight from the lunar pages server) but does not on yahoo. I set up an email address for use with PHP/Perl through yahoo, but I don't know a function to get it to send it through that domain. I even checked out the PHP documentation on the mail function. I figure there HAS to be a way, seeing how I'm pretty sure such a method is in high demand.... Thanks. EDIT: Disregard, it comes from an UNKNOWN SENDER.... Now I'm almost positive that that is the reason why Yahoo does not let it work. Link to comment https://forums.phpfreaks.com/topic/133971-solved-contact-form/ Share on other sites More sharing options...
revraz Posted November 24, 2008 Share Posted November 24, 2008 You can try putting your email here $mailheader = "From: <YOUR_EMAIL>\r\n"; Link to comment https://forums.phpfreaks.com/topic/133971-solved-contact-form/#findComment-697390 Share on other sites More sharing options...
Xelex Posted November 24, 2008 Author Share Posted November 24, 2008 You can try putting your email here $mailheader = "From: <YOUR_EMAIL>\r\n"; I love you. So much. Haha, thanks a ton xD It worked, now I can finally move my files to the main server. Link to comment https://forums.phpfreaks.com/topic/133971-solved-contact-form/#findComment-697396 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.