2013-01-09 18 views
19

Come si effettua una posta di bcc? Se invio quella mail, mi mostra tutti i destinatari!php mail bcc più destinatari

$to=array(); 
$members_query = mysql_query("select email from members"); 
while($row = mysql_fetch_array($members_query)) 
{ 
    array_push($to, $row['email']); 
} 

// To send HTML mail, the Content-type header must be set 
$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; 

// Additional headers 
//$headers .= 'To: '.$newName.' <'.$newEmail.'>' . "\r\n"; 
$headers .= 'From: SmsGratisan.com <[email protected]' . "\r\n"; 


mail(implode(',', $to), $title, $content, $headers); 

Grazie!

+0

è necessario aggiungere un'intestazione BCC con la lista dei destinatari. Vedi [il manuale] (http://php.net/manual/en/function.mail.php) per gli esempi. –

risposta

24

impostare il proprio mail di mettere in campo per null, e poi implodere l'array $to nelle intestazioni

$headers .= 'From: SmsGratisan.com <[email protected]' . "\r\n"; 
$headers .= 'BCC: '. implode(",", $to) . "\r\n"; 


mail(null, $title, $content, $headers); 
-1

Utilizzare passare semplicemente array invece di fare qualsiasi tipo di Implode, Set citazioni, comma ecc .

Esempio:

$bcc = array(); 

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

e superare Consiglia Mail Funzione:

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

Grazie, Ankit Patel

Problemi correlati