need PHP Bcc Mail send script

Discussion in 'PHP' started by shaileshk, Jul 26, 2006.

  1. #1
    How to send bcc email on php email send function
     
    shaileshk, Jul 26, 2006 IP
  2. sgthayes

    sgthayes Peon

    Messages:
    171
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This should do the trick :

    
    $headers = 'Bcc: bla@bla.com' . "\r\n";
    mail('bla@bla.com', 'subject goes here', 'message goes here', $headers);
    
    Code (markup):
     
    sgthayes, Jul 26, 2006 IP
  3. pierre

    pierre Active Member

    Messages:
    71
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    98
    #3
    pierre, Jul 26, 2006 IP
  4. tflight

    tflight Peon

    Messages:
    617
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I haven't tested this exact code, but I use something like this.

    <?php 
    mail('regular-recipient@example.com, another-regular-recipient@example.com', 
        'Subject', 'Insert Subject Here.', 
        "To: Recipient Name <primary-listed-recipient@example.com>\n" . 
        "From: Sender Name <my-address-from@example.com>\n" . 
        "cc: CC Name <regular-cc-recipient@example.com>\n" . 
        "Bcc: BCC Name <bcc-recipient@example.com>\n" . 
        "X-Mailer: PHP 4.x"); 
    ?>
    PHP:
    Basically you are specifying the headers yourself. You can see an example of this on this page.
     
    tflight, Jul 26, 2006 IP
  5. shaileshk

    shaileshk Well-Known Member

    Messages:
    455
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #5
    Thanks ALL
    got it
     
    shaileshk, Jul 26, 2006 IP
  6. petronel

    petronel Peon

    Messages:
    113
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    don't forgot about email header injection problems :)
     
    petronel, Jul 26, 2006 IP
  7. tflight

    tflight Peon

    Messages:
    617
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Good point if the script will be publicly accessible. There is a good article about PHP email injection attacks you will want to understand if the script is accessible to the outside world.
     
    tflight, Jul 26, 2006 IP