如何在php联系表单中添加cc?
问题描述:
我有一个HTML页面的联系表单。现在收件人只有一个。我如何添加多个收件人。任何帮助都是非常有帮助的。如何在php联系表单中添加cc?
代码如下。
谢谢。 ?
<?php
$to = "[email protected]";
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = "Message from $name ($email)";
$replyto = $email;
$headers="";
$headers = "From: test <[email protected]>\n";
$headers .= "Reply-To: $replyto";
$result = mail($to,$subject,$message,$headers);
>
答
这里是你的代码示例
$to = "[email protected]";
$subject = "This is subject";
$message = "<b>This is HTML message.</b>";
$message .= "<h1>This is headline.</h1>";
$header = "From:[email protected] \r\n";
$header .= "Cc:[email protected] \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$subject,$message,$header);
if($retval == true) {
echo "Message sent successfully...";
}else {
echo "Message could not be sent...";
}
+0
谢谢你Bikash保罗。我会尝试。 –
$标题= '抄送:[email protected]'。为 “\ r \ n” 个;您可以使电子邮件列表 – splash58
可能重复[PHP邮件,CC字段](http://*.com/questions/3582126/php-mail-cc-field) – Shubhamoy