Results 1 to 4 of 4

Thread: [RESOLVED] mail with BCC option :(

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Resolved [RESOLVED] mail with BCC option :(

    Hi
    i need some small help,
    please check this code, why my BCC users are not getting email with this code?
    Code:
    <?php
    $to = "[email protected], [email protected], [email protected]";
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Additional headers
    $headers .= 'To: domain <[email protected]>, domain <[email protected]>' . "\r\n";
    $headers .= 'From: domain <[email protected]>' . "\r\n";
    $headers .= 'Bcc: $to' . "\r\n";
     $subject = "Testing BCC";
    $body = "TEST MAIL";
     
     mail("[email protected]",$subject,$body,$headers);
     echo "mail sent";
    ?>

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: mail with BCC option :(

    Are you receiving any error messages from PHP? Are any of your recipients receiving email? Are you on a Windows server? Do you know what version of PHP you're running? Some people have commented on issues with BCC on PHP.net's mail() page (use Find and look for "bcc").

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: mail with BCC option :(

    The line:

    $headers .= 'Bcc: $to' . "\r\n"

    'Bcc: $to' Is not in double quotes, this means that the $to variable will not be expanded. Put it in double quotes and you should find it works fine.

    Also, the Bcc and Cc headers are interpreted by PHP not the mail transfer agent; PHP simply resends the same email . This means the address must be only and address and not a name followed by an address in angle brackets.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: mail with BCC option :(

    thanks it worked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width