Php没有向'';密件抄送'';及;至;

Php没有向'';密件抄送'';及;至;,php,html,email,Php,Html,Email,我的查询表单工作正常,但现在它只向Cce-mail id发送电子邮件 <?php if($_REQUEST["name"]) { ?> <?php $email;$comment;$captcha; if(isset($_POST['email'])){ $email=$_POST['email']; }if(isset($_POST['comment'])){ $email=$_POST['comment']; }if(iss

我的查询表单工作正常,但现在它只向
Cc
e-mail id发送电子邮件

<?php
if($_REQUEST["name"])
 {
?>
<?php
$email;$comment;$captcha;
    if(isset($_POST['email'])){
      $email=$_POST['email'];
    }if(isset($_POST['comment'])){
      $email=$_POST['comment'];
    }if(isset($_POST['g-recaptcha-response'])){
      $captcha=$_POST['g-recaptcha-response'];
    }
    if(!$captcha){
      echo '<h2>Please check the the captcha form.</h2>';
      exit;
    }
    $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=xxx&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
    if($response.success==false)

?>


<?php
if($_REQUEST["emailid"] || $_REQUEST["phone"])
{
$to = "mail2@123.in";

 $subject = "Enquiry on tour Packages from ".$_REQUEST["name"];

 $message = "
 <html>
 <head>
   <title>Enquiry from ".$_REQUEST["name"]."</title>
  </head>
    <body>
       <p><b>Dear Sir</b>,<br> I am interested in  Tour Packages, my details are given below</p>
<table>

 <tr>
  <td><b>Full Name :  </b>".$_REQUEST["name"]."</td></tr>
     <tr><td><b>Email ID :   </b>".$_REQUEST["emailid"]."</td></tr>
      <tr><td><b>Package :   </b>".$_REQUEST["type"]."</td></tr>
  <tr><td><b>Date of Arrival:   </b>".$_REQUEST["date"]."</td></tr>
    <tr><td><b>Country:   </b>".$_REQUEST["country"]."</td></tr>
   <tr><td><b>Phone:   </b>".$_REQUEST["phone"]."</td></tr>
    <tr><td><b>Adults Number :   </b>".$_REQUEST["adults"]."</td></tr>
    <tr><td><b>Kids Number:   </b>".$_REQUEST["kids"]."</td></tr>
    <tr><td><b>Comments:   </b>".$_REQUEST["comments"]."</td></tr>
   </table>
    <br>
    <p>Regards, <br> ".$_REQUEST["name"]."</p>
    </body>
     </html>
     ";

      // Always set content-type when sending HTML email
      $headers = "MIME-Version: 1.0" . "\r\n";
       $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

      // More headers
        $headers .= 'From: mail@123.com' . "\r\n";
        $headers .= 'Reply-To: no_reply@123.com' . "\r\n";
        $headers .= 'Cc: mail1@123.com' . "\r\n";
        $headers .= 'Bcc: mail@123.com' . "\r\n";
          if (mail($to,$subject,$message,$headers))
        {
         echo " Hi ".$_REQUEST["name"]." ! Your enquiry Sent Successfully";
           ?>
            <?php ; ?>

            <?php
            } else
               {

         echo "Mailer Error: Contact Reservation Department, call  Tel: +91 484 2381122, 4144144 or mail to emailid@xxx.com";

        }
       }
       }

         ?>

我希望这对您有所帮助

第一: 下载此库(--或--)

第二: 复制-将库粘贴到控制器中

下面是如何在代码中使用它

      private function send_forgot_password($data) {

        require(APPPATH.'controllers/mail-master/PHPMailerAutoload.php');

        // $email_encode=urlencode($data['email']);
        $mail = new PHPMailer;
        // $mail->SMTPDebug = 3;

        $mail->isSMTP();
        $mail->Host       = 'mail-host.com';
        $mail->SMTPAuth   = true;
        $mail->Username   = 'testing-alert@mail-host.com';
        $mail->Password   = '12345';
        $mail->SMTPSecure = 'tls';
        $mail->Port       = 25;

        // Email body
        $mail->From     = 'testing-alert@mail-host.com';
        $mail->FromName = 'Name';
        $mail->addAddress($data['email']);
        $mail->isHTML(true);

        $mail->Subject = 'Forgot Password';
        $mail->Body    = ' email body ';
        $mail->send(); 
}

对不起,上面的代码不是真的。我的邮件程序工作正常,但现在它只发送到复写副本ID必须是define:$headers.='to:Mary,Kelly'。“\r\n”;好的,我尝试了您的脚本,它在定义三个不同的收件人地址/邮箱时运行良好(包括抄送和密件抄送):to=john@doe.com; cc=jane@wilkinson.net; 密件抄送=claus@thaler.com但当我使用三个地址,其中有相同的邮箱,我只得到一次john@doe.com; jane@doe.com; claus@doe.com试试不同的邮箱吧,我会试试的,但这很好用。我能为密件抄送添加一个gmail帐户吗