I found a weird problem. My mail() function only sends to the last email address of my bcc list.

The code is like this:

/ To send HTML mail, you can set the Content-type header. /
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$headers .= "From: fromuser@yahoo.com\r\n";

$headers .= "Bcc: receiver1@lycos.com,receiver2@yahoo.com,receiver3@hotmail.com";

$content="<p>Test this!</p>";

mail("anybody@lycos.com", "Title here...", $content, $headers);

--- Finally, only anybody@lycos.com and receiver3@hotmail.com can get emails!!!

    Yes, I tried leaving space between emails... still did not work.

      until you figure out why it's not working, you could try doing multiple bcc headers, just remember to seperate with \n on posix and \r\n on windows.

      have you checked php.net for issues with the version you have?

        20 days later

        experienced the same problem, and found this thread without any answer... fortunately, the manual was again the solution.

        here is the explanation directly from the manual

        The Windows implementation of mail() differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a MTA is needed listening on a network socket (which can either on the localhost or a remote machine). Second, the custom headers like From:, Cc:, Bcc: and Date: are not interpreted by the MTA in the first place, but are parsed by PHP. PHP < 4.3 only supported the Cc: header element (and was case-sensitive). PHP >= 4.3 supports all the mentioned header elements and is no longer case-sensitive.

        simply put, if you are running php v4.2.3 (<v4.3) on a windows machine (localhost) like me, you are doomed... when i uploaded the codes to my webhoster (using linux systems) everything worked fine...

          Write a Reply...