1

嗨,这一切都是 PHP 即时通讯使用:

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$formcontent=" From: $name \n Phone: $phone \n Message: $message";
$recipient = "sophiec@fdb.co.uk";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='contact.html' style='text-decoration:none;
color:#ff0099;'> Return Home</a>";
?>

它工作得很好,但我希望在这封电子邮件中发送一些文本,上面写着“这是来自您的网站”或类似的内容,告诉收件人它不是垃圾邮件(我的客户对技术不友好,看到所有内容都是纯文本作为垃圾邮件)。我对 PHP 非常陌生,知识几乎为零,不知道如何添加类似的东西。我确实尝试过用里面的字符串创建一个新变量,然后将其包含在:

mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");

行,但没有成功。感谢您花时间提供任何帮助。

4

3 回答 3

3

更改此行:$formcontent=" From: $name \n Phone: $phone \n Message: $message";

添加你想要的内容:

$formcontent="This is from your website\n From: $name \n Phone: $phone \n Message: $message";

或者如果你想改变主题,这一行:$subject = "Contact Form";

添加你想要的内容:

$subject = "Contact Form - From your website";
于 2012-11-14T16:57:41.490 回答
0

您可以将其添加到$subject$message中。

  $subject = "Contact Form: This is from your website"; // OR
  $message .= "This is from your website";
于 2012-11-14T16:59:00.550 回答
0

$formcontent='这是来自您的网站\n 来自: ' 。$名称。'\n 电话:' 。$电话。'\n 消息:' 。$消息;

于 2012-11-14T17:08:33.270 回答