note 13183 deleted from ref.mail by jimw
| From: | jimw@php.net | Date: | Thu, 01 Nov 2001 19:59:37 +0000 |
| Subject: | note 13183 deleted from ref.mail by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20009@lists.php.net to get a copy of this message | ||
Sending BCC emails is not so straight forward as it may seems to be. My experience with configuring
this parameter proves the mentioned. So, first the task is to make application send email to all
addresses from the DB, but they should be in BCC field.
The code snippet:
<?
/* connection
db connection
db query*/
while ($row=mysql_fetch_array($result))
{
/* in the following display_block- (empty space)$email,(empty space) !very important*/
$email=$row['EMAIL'];
$display_block .="
$email, ";
}
$to="mainaddressee@hisserver.com";
$subject="TEST";
mail($to, $subject, $message, "from:joker@myserver.com\nBCC: $display_block");
echo "You mailing has been sent to:<br> $display_block ."
?>
As a result of 2 hours of trials-error-coffee cycle I've found that:
1.it must be: nBCC and not nbcc!
2.email addresses must be separated by comma(,), not by semi-column(;)
3.resultset - in my case it is var. $display_block - must have empty space in front and empty space
after the comma, otherwise all bcc addresses appear in the body of the message.