PDA

View Full Version : Display Sender??


pauldf
03-07-2010, 02:58 AM
Hi Guys

I was just wondering if anyone can help me with this problem i'm having. I have a basic form script on my website but when someone uses it , all the data that they have imputed appears in my email account except who sent it. when i go to my email account it says i have 1 new message but sender 'Unknown' , yet when i open the message the persons name , contact number, question and email address are there. Is there any way of getting the senders email to appear in my inbox as the sender rather then just another 'Unknown' ?
Below is the form script:


/* Subject and Email Variables */


$emailSubject = 'Contact Form';
$webMaster = 'pauldfoley@gmail.com';


/* Gathering Data Variables */

$emailField = $_POST['email'];
$nameField = $_POST['name'];
$contactField = $_POST['contact'];
$questionField = $_POST['question'];



$body = <<<EOD
<br><hr><br>
Name: $nameField <br>
Contact: $contactField <br>
Email: $emailField <br>
Question: $questionField <br>
EOD;


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


/* Results rendered as HTML */


Like i said it's a basic form script that i put together in cs3 but i don't really need much more then that, i'm really hoping that someone can help me with this or can point me in the right direction as to where i can get info on how to fix it.

Thank guys

Paul

pauldf
03-07-2010, 03:04 AM
Sorry guys

I found where i was going wrong, my bad

Corrosive
03-07-2010, 07:11 AM
I assume you changed this;

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

To this;

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

Correct?

davidj
03-07-2010, 08:19 AM
also you're using $webMaster in your mail function but i cant see where you are defining it

not sure if variables will parse in EOD

Corrosive
03-07-2010, 08:32 AM
also you're using $webMaster in your mail function but i cant see where you are defining it

not sure if variables will parse in EOD

Isn't this bit right then? $webMaster = 'pauldfoley@gmail.com';

davidj
03-07-2010, 03:42 PM
aye

missed the wood for the trees

pauldf
03-07-2010, 09:16 PM
How's things guys

Yeah i changed it to $emailField i completely overlooked it, Thanks for posting though. Cheers