【问题标题】:How to add a cc in a php contact form?如何在 php 联系表单中添加 cc?
【发布时间】:2016-04-30 08:23:13
【问题描述】:

我有一个 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);

?>

【问题讨论】:

  • $headers .= '抄送:birthdayarchive@example.com' 。 "\r\n";您可以制作电子邮件列表
  • PHP Mail, CC Field的可能重复

标签: php forms contact


【解决方案1】:

这是您的示例代码

     $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...";
     }

【讨论】:

  • 谢谢比卡什保罗。我会试试的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-01-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-07-28
相关资源
最近更新 更多