I cannot get the email address of the sender to display in the inbox, only in the body.
<?php
$name = '';
$phone = '';
$email = '';
$comments = '';
if(isset($_POST['subm'])) {
$error = array();
$data = array();
include "../datafunction.php";
/*Please modify variable values according to requirement*/
$min = 3; //Min length of string
$max = 10; // Max length of string
$maxc = 300; // Max length of string
$receiverEmail = 'someone@gmail.com'; //Set Email Receiver Email address
$receiverName = 'Mike'; //Set Email Receiver name
$FromEmail ='email'; //Set From Email
$FromName = 'name'; //Set From name
$mailSubject = 'Mail for Me'; //Set Email subject
/*End*/
foreach($_POST as $key=>$val)
{
if($key=='name')
{
if(validBlank($val) == 1)
{
$error[] = "Name cannot blank";
}
$checkLength = validStrLen($val,$min,$max);
if($checkLength!=1)
{
if($checkLength == 'short') {
$error[] = "Name is too short, minimum is ".$min." characters (".$min.", ".$max.")";
} else {
$error[] = "Name is too long, maximum is ".$max." characters (".$min.", ".$max.")";
}
}
$name = fnSanitizeStringr($val);
}
if($key=='phone')
{
if(validBlank($val) == 1)
{
$error[] = "Phone number cannot blank";
}
$validation = new PhoneValidation();
$isvalidPhone = $validation->validate('phone',$val);
if($isvalidPhone != 1)
{
$error[] = 'Phone number is not in valid US Format';
}
$phone = $val;
}
if($key=='email')
{
if(validBlank($val) == 1)
{
$error[] = "Email address cannot blank";
}
$val = fnSanitizeEmaill($val);
$test = new EmailValdation;
$test->email = $val;
if($test->checkEmailDomain() == 0) { //Check DNS of Email Address
$error[] = 'Invalid email address';
}
$email = $val;
}
if($key=='comments')
{
if(validBlank($val) == 1)
{
$error[] = "Comments cannot blank";
}
echo $checkLength = validStrLen($val,$min,$maxc);
if($checkLength!=1)
{
if($checkLength == 'short') {
$error[] = "Comments field is too short, minimum is ".$min." characters (".$min.", ".$max.")";
} else {
$error[] = "Comments field is too long, maximum is ".$maxc." characters (".$min.", ".$max.")";
}
}
$comments = fnSanitizeStringr($val);
}
$data[$key] = _clean($val);
}
if(count($error) > 0)
{
echo '<div class="error"><ul>';
foreach($error as $er)
{
echo '<li>'.$er.'</li>';
}
echo '</ul></div>';
}
else {
$msg = "<table><tr><td>Name:</td><td>".$data['name']."</td></tr>
<tr><td>Phone:</td><td>".$data['phone']."</td></tr>
<tr><td>Email:</td><td>".$data['email']."</td></tr>
<tr><td>Comments:</td><td>".$data['comments']."</td></tr></table>";
require '../mailer/PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
// Set PHPMailer to use the sendmail transport
$mail->isSendmail();
//Set who the message is to be sent from
$mail->setFrom($FromEmail,$FromName);
//Set who the message is to be sent to
$mail->addAddress($receiverEmail,$receiverName);
//Set the subject line
$mail->Subject = $mailSubject;
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($msg);
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
header("Location: thank-you.html");
}
}
} ?>
<body>
I believe it is an error in the FromEmail . I have changed that to $email and still no change