note 85476 modified in function.mail by danbrown

From: Date: Sat, 25 Apr 2009 14:55:58 +0000
Subject: note 85476 modified in function.mail by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153722@lists.php.net to get a copy of this message
The work-around for a large quantity of recipients is putting the adresses in the header-section as Bcc adresses. In this way the mail()-function opens and closes the SMTP connection only once: <?php $count_recip= count($recip);//where $recip represents an array of mail-adresses, from MySql-query or otherwise $count='0'; $headers.="Bcc: "; while($count < $count_recip){ $headers.=$recip[$count].", "; $count ++; } $headers.="admin@mailinglist.com\r\n"; ?> --was-- The work-around for a large quantity of recipients is putting the adresses in the header-section as Bcc adresses. In this way the mail()-function opens and closes the SMTP connection only once: <? $count_recip= count($recip);//where $recip represents an array of mail-adresses, from MySql-query or otherwise $count='0'; $headers.="Bcc: "; while($count < $count_recip){ $headers.=$recip[$count].", "; $count ++; } $headers.="admin@mailinglist.com\r\n"; ?> http://php.net/manual/en/function.mail.php

« previous php.notes (#153722) next »