mfallon Posted April 4, 2009 Share Posted April 4, 2009 So folks, I have an issue with the BCC functionality in the mail function of PHP. Let me say that the e-mail is being sent fine but I am finding that the BCC field is being displayed in e-mail clients so the list of recipients is not being hidden as I require. The code is below; /** * sendNewsletter - Sends newsletter to all users. */ function sendNewsletter($body,$bcc){ $email = "[email protected] Vall Fraser - OSC"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: [email protected] Vall Fraser - OSC\r\n"; $headers .= "Bcc: ".$bcc."\r\n"; $subject = "One Hundred Straight Club Newsletter"; $message = "<html> <head> <link href=\"http://osc.logicalthinking.co.nz/styles/style.css\" rel=\"stylesheet\" type=\"text/css\" /> <title>One Hundred Straight Club Newsletter</title> </head> <body> <table width\"900\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"> <tr><td align=\"right\"><img src=\"http://osc.logicalthinking.co.nz/images/logo.gif\" width=\"152\" height=\"100\" /></td> <td width=\"10\"> </td> <td align=\"left\" valign=\"middle\"><span class=\"title\">OSC Newsletter</span></td></tr> <tr bgcolor=\"#10195A\"><td colspan=\"3\" align=\"left\" valign=\"top\"> </td></tr> <tr bgcolor=\"#FFFFFF\"><td colspan=\"3\" align=\"left\" valign=\"top\">".$body."</td></tr> <tr bgcolor=\"#FFFFFF\"><td colspan=\"3\" align=\"left\" valign=\"top\"> </td></tr> <tr bgcolor=\"#FFFFFF\"><td colspan=\"3\" align=\"left\" valign=\"top\">Vall Fraser<br>One Hundred Straight Club<br><a href=\"http://osc.logicalthinking.co.nz/\">www.englishskeet-osc.co.uk</a></td></tr> <tr bgcolor=\"#10195A\"><td colspan=\"3\" align=\"left\" valign=\"top\"> </td></tr> </table> </body> </html> "; return mail($email,$subject,$message,$headers); } The value being passed in as $bcc is below; [email protected],[email protected],[email protected], I'm using a SQL query on my database to add the e-mail addresses to the form which submits the content, and again this is working fine. Does anyone know why I would be able to see all recipients in the BCC field in the e-mail client? My server is running PHP 5.2.5 and Apache 1.3.37. Many Thanks, Matt Link to comment https://forums.phpfreaks.com/topic/152572-mail-function-problem-bcc-not-working-correctly/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.