0

您好,当我收到来自客户的任何邮件时,我使用了联系表格,我看到我的主机名显示在来自的邮件中。就像我在打开我的邮件之前看到的那样,那里显示了谁发送的姓名,以及我从哪里看到我的主机名 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); 
4

1 回答 1

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;
于 2013-08-15T02:59:01.840 回答