Jump to content

"from" header shows nobody


nandos

Recommended Posts

Hi,

Does anybody know why I'm seeing "nobody" on the email "from" header why I receive email which is sent by the web form?

Below is the code,  I deeply appreciate if someone can tell me what I did wrong

 

[color=red]<?PHP

/* SUBJECT AND EMAIL VARIABLE */
$emailSubject = ' Crystal Ashley Web Enquiry Form '; 
$webMaster = 'tjoengkikitjahyadi@gmail.com, james.k.tj@gmail.com ';


/* gathering data variable */

$emailField = $_POST['email'] ;
$nameField = $_POST['name'] ;
$phoneField = $_POST['phone'] ;
$countryField = $_POST['country'] ;
$commentsField = $_POST['comments'] ;



$body = <<<EOD
<br><hr><br>
Email : $email <br>
Name : $name <br>
Comments : $comments <br>
<br>
EOD;

$headers = "From : $emailSubject\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/*results rendered as html*/
$theResults = <<<EOD

<html>
<head>
<title>Crystalashley</title>
</head>

<div>
  <div align="left"><img src="../images/logo.png" width="454" height="407"></div>
</div>
</body>
</html>
EOD;
echo "$theResults";


?>[/color]

 

Link to comment
Share on other sites

The From: header should be an email address that is valid on your server, not the email the user submits. And the value assignment to the variable in your code is assigning the Subject string to the  From: header . . .

$headers = "From : $emailSubject\r\n";

Link to comment
Share on other sites

Try this code and see which message makes it through and what the From line reads:

<?php
$from = array('nobody@example.com','nobody@yourdomain.com');
foreach ($from as $f) {
   mail('youremail@address.here','Test from 2','Again, nothing here',"From: Just Testing <$f>","-f $f");
}
?>

 

Ken

Link to comment
Share on other sites

I've changed the code but it's still not working  :confused:

 

<?PHP

/* SUBJECT AND EMAIL VARIABLE */
$emailSubject = ' Crystal Ashley Web Enquiry Form '; 
$webMaster = 'tjoengkikitjahyadi@gmail.com, james.k.tj@gmail.com ';


/* gathering data variable */
$emailField = $_POST['email'] ;
$nameField = $_POST['name'] ;
$phoneField = $_POST['phone'] ;
$countryField = $_POST['country'] ;
$commentsField = $_POST['comments'] ;



$body = <<<EOD
<br><hr><br>
Email : $email <br>
Name : $name <br>
Phone : $phone <br>
Country : $country <br>
Message : $comments <br>
<br>
EOD;

$headers = "From : $webMaster\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

 

 

 

Link to comment
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.