mail () 函数就可以搞定了
很简单的 自己试试
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="[email protected]";
$subject="TEST"; mail($to, $subject, $message, "from:[email protected]\nBCC: $display_block"); echo "You mailing has been sent to:
$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.
很简单的 自己试试
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="[email protected]";
$subject="TEST"; mail($to, $subject, $message, "from:[email protected]\nBCC: $display_block"); echo "You mailing has been sent to:
$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.
有详细的介绍和代码
有详细的介绍和代码
演示地址:http://chinesehis.com/editmail.php
我的论坛地址:http://chinesehis.com