Jump to content

Small PHP email issue


danp2010

Recommended Posts

Hi Guys, I have a small issue with a new php script I wrote.  It works fine, except for one issue.  When the scrip emails me the info it captures, I need it to have the email sent to me from the person filling out the form.  i.e.  from the email address located in the $email field.  It does not.  Here's the code. (domain.com is just a dummy name to hold the spot, obviously.)

 

<?php

 

/* Subject and email */

 

$emailSubject = 'Centre Street Registration';

$webMaster = '[email protected]';

 

/* Gathering Data */

 

$firstname = $_POST['FirstName'];

$lastname = $_POST['LastName'];

$email = $_POST['Email'];

$daytime = $_POST['Daytime'];

$home = $_POST['Home'];

$citytown = $_POST['CityTown'];

$movingwhen = $_POST['MovingWhen'];

$hearofus = $_POST['HearofUs'];

$contactmethod = $_POST['ContactMethod'];

$squareft = $_POST['SqareFt'];

$important = $_POST['Important'];

$pricerange = $_POST['PriceRange'];

 

$body = <<<EOD

 

 

First Name: $firstname

Last Name: $lastname

Email: $email

Daytime Number: $daytime

Home Number: $home

City: $citytown

Moving When: $movingwhen

Hear of Us: $hearofus

Contact Method: $contactmethod

Square Feet: $squareft

Important to You: $important

Price Range: $pricerange

 

Excel Data: $firstname,$lastname,$email,$daytime,$home,$citytown,$movingwhen,$hearofus,$contactmethod,$squareft,$important,$pricerange

EOD;

 

$headers = "From: $email";

$headers .= "Conten-type: text/html";

$success = mail($webMaster, $emailSubject, $body);

 

/* Results rendered as HTML */

 

/* $theResults = 'domain.com'; */

 

header( "Location: http://www.dommain.com/thankyou_centre.shtml" );

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/209796-small-php-email-issue/
Share on other sites

I need it to have the email sent to me from the person filling out the form.

 

No, you don't. It is your mail server that is sending the email to you. The From: address must be a valid mail box at the sending mail server. You would want to put the visitor's entered email address into the Reply-to: address in the header.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.