【问题标题】:contact form showing my host address. when i got message显示我的主机地址的联系表格。当我收到消息时
【发布时间】:2013-08-15 10:59:01
【问题描述】:

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

【问题讨论】:

    标签: php contact


    【解决方案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;
    

    【讨论】:

    • 不应该是$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n".$headers; 吗?等号前面缺少点。
    • @Fred 我留下它是因为我理解他可能希望内容类型标题成为第一个
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-18
    • 1970-01-01
    • 2013-08-13
    • 1970-01-01
    • 2017-11-21
    • 2018-12-07
    • 1970-01-01
    相关资源
    最近更新 更多