PDA

View Full Version : BCC Issue with PHP mail() function...



danguru
09-19-2004, 10:53 AM
Hello, I've been working on a script to send mail to a list of email addresses put together in a DB (i.e. a newsletter). I do not want to make the email addresses public knowledge, so I want to BCC everyone.

To test this, I made up a BCC list that contains one AOL address and one that I use with Westhost (that I read through Outlook). The BCC header looks something like this:

$sPassHeaders .= "BCC: ".$sBCC."\r\n";

That is just a snippet. Assume it is in the right place because the email works fine if I change "BCC" to either "CC" or "To". What I'm trying to say is that sending the email with the BCC label only ends up sending the email to the AOL address. The Outlook address never sees the email. Curious if Outlook is doing something to reject the BCC?

nsc
09-19-2004, 11:56 AM
Hi and welcome. Thanks for sharing your problem with us.

You need to remove the space after BCC.

I had no idea why you have this sort of problem but I performed a Google search for "php bcc problem" and I think I found the solution.

http://bugs.php.net/bug.php?id=23798&edit=3

There is a bug in PHP 4.3.2RC4 and 4.3.1 that got fixed by a developer in July 2003. Westhost uses PHP 4.3.0 if I remember well. The problem is that "Bcc:somone@somewhere.com,somone2@somewhere.com" works but "Bcc: somone@somewhere.com,somone2@somewhere.com" doesn't work.

I also found this: http://bugs.php.net/bug.php?id=21036

and this: http://forum.hivemail.com/showthread.php?t=2125

and this: http://www.sitepoint.com/forums/showthread.php?t=186095

I hope this was really the solution to your problem. Good luck!

NSK

danguru
09-19-2004, 07:56 PM
Thank you for the info. Unfortunately, the links presented are not dead on in regards to the problem that I am seeing. As I was reading these links and doing some more research on my own, I got to thinking about why AOL was getting the BCC and Outlook was not.

As a result, I decided to send myself a message from AOL to Outlook. In this message, I included an email in the "To" and a different email in the "BCC" lines. Sure enough, the "To" address received just fine and the "BCC" address was nowhere to be found. This pretty much means that this problem is not a PHP problem at all, but rather there must be some sort of setting in Outlook that is blocking mail for BCC (or perhaps it is blocked on Westhost's server for whatever reason -- don't know).

Anyway, thank you very much for the help thus far. And if you know what the deal with this "BCC blocking" is from Outlook, please feel free to share.

Thank you.

nsc
09-19-2004, 11:31 PM
I don't know, but I suggest visiting Microsoft's Knowledge Base and searching, if it is a bug maybe there is a fix.

If you just want a mailing list you may consider using Mailman (http://www.list.org) or the app that is included in Site Manager (IIRC it's mojo).

There is also the solution to build a FOR loop in PHP and send many emails using only the To: header. Unfortunately this may increase the email traffic and server resources usage.

To determine whether it is a problem with Westhost I would suggest trying another email client, download Thunderbird from http://www.mozilla.org

FZ
09-23-2004, 01:00 PM
danguru,

I doubt Outlook is removing the mail silently (unless you have set up some aggressive filters). Two things occurred to me:

1. If the address that goes in the BCC: you are sending to is WestHost-hosted, check and make sure that the address in question has a home directory assigned to it via your Site Manager (if not, edit it and give it FTP access, then go back in and disable FTP access if you don't need it). You could also check your mailq, and look for a file called dead.letter (or something similar) in / (root directory).

2. If none of the above works, you could send a few test e-mails to yourself, but before checking in Outlook, check the e-mail account out using webmail (either install your own via your Site Manager or use (http://webmail.westhost.com). If you see it in there, that confirms that Outlook is the problem. If you don't, well, then that means something else is wrong...