fiftyseven Posted April 11, 2007 Share Posted April 11, 2007 I'm still new to php, but i having a lot of trouble trying to get this script to work, i think its cause my host(yahoo) doesn't allow it. I keep getting this error "From address not in member domain. Message not sent." what its supposed to do is the user types their email in the form then hits submit,so their email comes to me, thing is that i did it all in flash, which shouldn't make a difference. can someone please help me? Is there anyway around it? below is the script I've been trying to use. i downloaded from the following site. thanks. <?php /* PHP-FLASH EMAIL/CONTACT FORM Designed By: Mike Kreidel 2006 http://www.azwebdesigns.com */ // This script will take all the info from the Name, Email, Phone and Message boxes, and email it to you. // Probably the most Simple Email Script out there. Works perfectly and can be customized. // New function prevents hackers and spammers from population this form with invalid characters. // The $sendTo = should be changed to the email address this email gets sent to (i.e; Your Email Address) // The $subject = is what will show in the 'Subject' line of the email you recieve (i.e; Email From Your Website) // !!!! EDIT THE NEXT TWO LINES !!!! $sendTo = "info@dthxdsn.com"; $subject = "Add Me "; ///////////// Everything Below can remain unchanged ///////////////// $headers = "From: " . $_POST["name"] ." <" . $_POST["email"] .">\r\n"; $headers .= "Reply-To: " . $_POST["email"] . "\r\n"; $headers .= "Return-path: " . $_POST["email"]; $message = $_POST["message"] ."\r\n". $_POST["name"] ."\r\n". $_POST["phone"]; function hasNewlines($str) { return preg_match("/(%0A|%0D|\n+|\r+)/i", $str); } if (hasNewlines($_POST['name']) || hasNewlines($_POST['email'])) { die('No email for you!'); } mail($sendTo, $subject, $message, $headers); ?> Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/ Share on other sites More sharing options...
Glyde Posted April 11, 2007 Share Posted April 11, 2007 Quote (http://www.thesitewizard.com/faqs/feedbackform.shtml#fromdomain): Why do I get a "From address not in member domain" error? Some web hosts do not allow scripts to set the "From:" header in email messages to an address that is outside your domain. For example, if your domain is "example.com", the "From:" header should be something like "some-address@example.com". Since your visitor is unlikely to have an email address at your domain, the email address he types in will be rejected by your web host, and his message will not be sent. At present, you have only two ways to fix this problem: 1. Use another script. Check if your web host provides a feedback form script that will work around this problem. 2. Change to another web host - obviously one that does not have this policy. For example, evaluate the web host that I am currently using and see if it suits you. Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227288 Share on other sites More sharing options...
fiftyseven Posted April 12, 2007 Author Share Posted April 12, 2007 yea i read that, so is there anyway around it? like some other script? Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227292 Share on other sites More sharing options...
Glyde Posted April 12, 2007 Share Posted April 12, 2007 You can try phpmailer (from sourceforge). It's a nice PHP class that has tons of mailing features. It should work since it never uses the mail() function. Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227295 Share on other sites More sharing options...
fiftyseven Posted April 12, 2007 Author Share Posted April 12, 2007 so i downloaded the phpmailer but by reading just the tutorial im kind of confused. do i just upload the class php file, and where do i plugin in my info? i have the feeling that this should work but i just need to figure out what to do. Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227309 Share on other sites More sharing options...
Glyde Posted April 12, 2007 Share Posted April 12, 2007 Code snippet from the "First Time" tutorial (http://phpmailer.sourceforge.net/tutorial.html#2): <?php require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "smtp.email.com"; // SMTP server $mail->From = "from@email.com"; $mail->AddAddress("myfriend@site.com"); $mail->Subject = "first mailing"; $mail->Body = "hi ! \n\n this is First mailing I made myself with PHPMailer !"; $mail->WordWrap = 50; if(!$mail->Send()) { echo "Message was not sent"; echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227312 Share on other sites More sharing options...
fiftyseven Posted April 12, 2007 Author Share Posted April 12, 2007 okay, so i replace my current php script, for the class.phpmailer.php, update my flash file for that script then create a new php file and add the above code, then test it, right? Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227321 Share on other sites More sharing options...
Glyde Posted April 12, 2007 Share Posted April 12, 2007 Upload class.phpmailer.php but don't delete your old file. Just replace the contents of the old file with the script that I just posted. Edit the variables as needed. Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227330 Share on other sites More sharing options...
fiftyseven Posted April 12, 2007 Author Share Posted April 12, 2007 i cant get it to work. under host: smtp.bizmail.yahoo.com from: info@dthxdsn.com i try to test it but i keep getting the same error. Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227338 Share on other sites More sharing options...
Glyde Posted April 12, 2007 Share Posted April 12, 2007 Well then you are not going to be able to set the from address to the user submitting the information. How about you set the from NAME to the user submitting it, so your header would look like: Feedback Form (someemail@somedomain.com) <youremail@yourdomain.com> It should let you do that Quote Link to comment https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227588 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.