Jump to content

Recommended Posts

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);

 

?>

Link to comment
https://forums.phpfreaks.com/topic/46660-help-with-form-script/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227288
Share on other sites

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";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227312
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/46660-help-with-form-script/#findComment-227588
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.