我正在尝试发送一个简单的电子邮件表单,一切正常,但我仍然在正文消息的末尾收到收件人的电子邮件。我检查了PHP代码,但我找不到为什么再次显示该电子邮件,这里是PHP代码:
$name = $_POST['name'];
$company = $_POST['company'];
$website = $_POST['website'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];
$email_from = 'juano.diy@gmail.com';//<== update the email address
$email_subject = "New Form submission";
$email_body = "You have received a new message from the user $name.\n".
"Company: $company.\n".
"Website: $website.\n".
"Contact Email: $visitor_email.\n".
"Here is the message:\n$message.\n".
"\n".
$to = "juano.diy@gmail.com";//<== update the email address
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
我将以下列形式介绍这些细节:
Name: xxx
Company: xxx
website: www.xxx.com
email: xxx@live.com
message: Hi testing email
这就是我收到的内容:
You have received a new message from the user Juan Camilo.
Company: Blitzar.
Website: www.stiktag.com.
Contact Email: juano.diy@live.com.
Here is the message:
Hi, testing website.
juano.diy@gmail.com
问题是最后一行(juano.diy@gmail.com),当我已经将它添加到标题中时,为什么我会收到该地址,我不想在那里看到它,有什么想法?
答案 0 :(得分:1)
float A=24000000;
float B= A + 1; //~1 error here
的最后一行正在连接。
$email_body
将最后一行替换为$email_body = "You have received a new message from the user $name.\n".
"Company: $company.\n".
"Website: $website.\n".
"Contact Email: $visitor_email.\n".
"Here is the message:\n$message.\n".
"\n".
"\n".
- 注意分号。这将终止分配。