你好,当我从我的客户端收到任何邮件时,我使用了联系表格,我看到我的主机名显示在邮件中。就像我在打开邮件之前看到的那样,显示出发送的姓名,从那里我看到那里显示我的主机名geologicsdz@host.dramaclassesonline.com。 但在邮件中一切都好。 所以我想更改主机名,必须从他的电子邮件地址显示
$post = (!empty($_POST)) ? true : false;
$replyto='my@email.com';
if($post)
{
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$business = stripslashes($_POST['business']);
$comments = stripslashes($_POST['comments']);
$phone = stripslashes($_POST['phone']);
$howhear = stripslashes($_POST['howhear']);
$to=$toemail.','.$replyto;
$error = '';
$headers="";
$headers.="Reply-to:$replyto\n";
$headers .= "From: $email\n";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers = "Content-Type: text/html; charset=iso-8859-1\n".$headers;
if(!$error)
{
$messages="<h2>From: $name has contacted Geological Solutions</h2>";
$messages.="<h4>Name: $name </h4>";
$messages.="<h4>Email: $email </h4>";
$messages.="<h4>Phone: $phone </h4>";
$messages.="<h4>How did you hear about us?: $howhear </h4>";
$messages.="<h4> Comments: $comments </h4>";
$mail = mail($to,$name,$messages,$headers);
答案 0 :(得分:1)
你是在正确的路径,但已覆盖你的标题。这是修复它
$headers="";
$headers.="Reply-to:$replyto\r\n";
$headers .= "From: $email\r\n";
$headers .= 'MIME-Version: 1.0';
$headers = "Content-Type: text/html; charset=iso-8859-1\r\n".$headers;