0

我有一个与表单结合使用的非常简单的电子邮件脚本。

<?php 
$fName = $_POST;
$access = array_values($fName);
$emailString ="         Name: ".$access[0]." ".$access[1]."\n
                Organization: ".$access[2]."\n
                Email: ".$access[3]."\n
                Number: ".$access[4]."\n
                What They Wrote: ".$access[5]."\n";

$to = "clients@email.com, my@email.com";
$messageSubject = "Somebody has contacted you from ClientsWebSite";
$messageBody = wordwrap($emailString, 55, "\n");
$headers = "From: noreply@clientswebsite.com\r\n" ."X-Mailer: php";

if(mail($to, $messageSubject, $messageBody, $headers)){
    echo("<script> var mailSent = true </script>");
}else{
    echo("<script> var mailSent = false </script>");
}

    ?>

上面的代码是一个非常快速和肮脏的“发送评论”类型的表单。问题是,如您所见,我收到了发送给我的电子邮件和客户的电子邮件地址。我有 gmail,我收到了完整的信,如下所示:

noreply@clientswebsite.com 上午 11:23(5 分钟前)

给客户,我

                                   Name: One MoreTime

                                   Organization: WeGottaDancin

                                   Email: OoohYeah@wegottheDancin.com

                                   Number: 0123456789

                                   What They Wrote:  ONE MORE TIME

但是当他收到电子邮件时,电子邮件的“他们写了什么”部分并不存在。我已经进行了一些搜索,但无法提出可行的解决方案。

有人有想法吗?

4

0 回答 0