如何在 php 联系表格中添加抄送?

How to add a cc in a php contact form?

我有一个 HTML 页面的联系表。现在收件人只有一个。如何添加多个收件人。在这方面的任何帮助将是一个很大的帮助。

代码如下。

谢谢。

<?php

$to = "support@domain.in";

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

$subject = "Message from $name ($email)";
$replyto = $email;

$headers="";
$headers = "From: test <domain@one.com>\n";
$headers .= "Reply-To: $replyto";

$result = mail($to,$subject,$message,$headers);

?>

这是您的示例代码

     $to = "xyz@somedomain.com";
     $subject = "This is subject";

     $message = "<b>This is HTML message.</b>";
     $message .= "<h1>This is headline.</h1>";

     $header = "From:abc@somedomain.com \r\n";
     $header .= "Cc:afgh@somedomain.com \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...";
     }