THUNDERPOWER
New Member
- Reaction score
- 1
I have a PHP script that emails me the form the user fills-in on my website. The problem is, when I receive the email, the sender (person who filled in the form) does not get a confirmation email like they should. This is because the sender's name/email end up mixed up.
Example 1:
"[email protected]" is the sender's email. As you can see in the grey square brackets, the email address ends up being mixed up with the sender's name.
This is the script used for Example 1:
Example 2:
Now, if I change
from the code above to
, I will get this:
As you can see from Example 2, the sender's email will display my server's email instead causing the REAL sender not to receive my confirmation email.
This is a very big problem and I need to change it so that the sender WILL receive a confirmation email by acquiring the right email address from the form.
Example 1:
"[email protected]" is the sender's email. As you can see in the grey square brackets, the email address ends up being mixed up with the sender's name.
This is the script used for Example 1:
Code:
<?
$sfname = $_POST['firstname'];
$slname = $_POST['lastname'];
$ssex = $_POST['sex'];
$semail = $_POST['email'];
$shome = $_POST['home'];
$scell = $_POST['cell'];
$sstreet = $_POST['street'];
$scity = $_POST['city'];
$spostcode = $_POST['postcode'];
$sprovince = $_POST['province'];
$scountry = $_POST['country'];
$sposition = $_POST['position'];
$sheard = $_POST['heard'];
$scrime = $_POST['crime'];
$swork = $_POST['work'];
$sresume = $_POST['resume'];
$sreference = $_POST['reference'];
$msg = "First Name: $sfname\nLast name: $slname\nSex: $ssex\nEmail: $semail\nHome Tel: $shome\nCell No: $scell\nStreet: $sstreet\nCity: $scity\nPostcode: $spostcode\nProvince: $sprovince\nCountry: $scountry\nPosition Applied for: $sposition\nHead About us: $sheard\nConvicted of Crime: $scrime\nEntitled to work: $swork\nResume: $sresume\n References: $sreference\n";
$recipient = "[email protected]";
$subject = "Job Application Form";
$mailheaders = "From:$sfname $slname";
$mailheaders .= "Reply-To:".$_POST['email'];
mail($recipient, $subject, $msg, $mailheaders);
header("Location:success.html");
?>
Example 2:
Now, if I change
Code:
$mailheaders = "From:$sfname $slname";
$mailheaders .= "Reply-To:".$_POST['email'];
Code:
$mailheaders .= $_POST['email'];
As you can see from Example 2, the sender's email will display my server's email instead causing the REAL sender not to receive my confirmation email.
This is a very big problem and I need to change it so that the sender WILL receive a confirmation email by acquiring the right email address from the form.