phpbar.de logo

Mailinglisten-Archive

[php] BCC in mail()

[php] BCC in mail()

Nicolas Löwe php_(at)_phpcenter.de
Thu, 23 Aug 2001 08:55:40 +0200


Ich will ja nicht nerven, echt nicht, aber hier nochmal der gesamte
Kommentar aus dem Manual.
Und wie kann es dann bei ihm funktionieren, wenn es nicht geht??????
Ausserdem wurde der BCC Header hier schonmal diskutiert, aber in anderem
Zusammenhang.

-------Schnipp----------
a_selivanov_(at)_yahoo.com
01-Jun-2001 08:49

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_(at)_hisserver.com"; 
$subject="TEST"; 

mail($to, $subject, $message, "from:joker_(at)_myserver.com\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.
 
-------schnapp-------------------
--------------------
Nicolas Löwe - forHeads GbR, Goethestr. 33, 06237 Leuna
email: loewe_(at)_forHeads.de;  internet: www.forHeads.de
Tel: +49 (0) 3461/826465 
 
Bitte besuchen Sie auch unser Projekt Möwendreck unter www.moewendreck.de !




php::bar PHP Wiki   -   Listenarchive