php mail bcc multiple recipients

后端 未结 4 1557
萌比男神i
萌比男神i 2020-12-06 10:14

How do I make a bcc mail? If I send that mail, It shows me all the recipients!

$to=array();
$members_query = mysql_query(\"select email from members\");
whil         


        
相关标签:
4条回答
  • Set your mail to field to null, and then implode your $to array in your headers

    $headers .= 'From: SmsGratisan.com <admin@website.com' . "\r\n";
    $headers .= 'BCC: '. implode(",", $to) . "\r\n";
    
    
    mail(null, $title, $content, $headers);
    
    0 讨论(0)
  • 2020-12-06 10:25
    $headers .= 'Bcc: mail@example.com' . "\r\n";
    
    0 讨论(0)
  • 2020-12-06 10:36

    CC and BCC can be sent as headers (see: http://php.net/manual/en/function.mail.php).

    You can also use other mail libraries - the PEAR Mail library makes sending emails a little more object-oriented. http://pear.php.net/package/Mail/redirected

    0 讨论(0)
  • 2020-12-06 10:42

    Please use pass Just Array instead of doing any kind of Implode, Set quotes, comma etc.

    Example:

        $bcc = array();
    
        foreach ($users as $user) 
        {
            $bcc[] = $user['User']['email'];
        }   
    

    And pass This To Mail Function:

            $email->from($from)
    //            ->to($from)
                  ->bcc($bcc)
    

    Thanks, Ankit Patel

    0 讨论(0)
提交回复
热议问题