mail() function question

Discussion in 'PHP' started by bobby9101, Aug 29, 2007.

  1. #1
    Hi, i want to send use the mail() function to send to 10 people at once, however I only want only the receiver to be able to see their email address in to the "to" field instead of all 10.
    How do I do this?
    Thanks
     
    bobby9101, Aug 29, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Put them in the additional headers, in the CC: section.
     
    nico_swd, Aug 29, 2007 IP
  3. webw

    webw Peon

    Messages:
    32
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The correct section is BCC.

    BCC, refers to the practice of sending a message to multiple recipients in such a way that what they receive does not contain the complete list of recipients.
     
    webw, Aug 29, 2007 IP
  4. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, I use bcc, but what to I put for the to field? If I leave it blank, than it still goes out but when I receive it, there is no to field. Which looks weird and may have some issues with some email providers.
     
    bobby9101, Aug 29, 2007 IP
  5. Adventis

    Adventis Guest

    Messages:
    66
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What's wrong with the handy for loop? Since you know the number of emails to send, use a for loop..

    psuedocode incoming:-

    
    $newRecipient := Array of Email Addresses;
    for($x=0; $x<=10; $x++)
      mail($newRecipient[x], .., .., ..);
    
    Code (markup):
     
    Adventis, Aug 29, 2007 IP
  6. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Just was wondering if there was a way to do it the other way.
     
    bobby9101, Aug 29, 2007 IP
  7. Adventis

    Adventis Guest

    Messages:
    66
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I guess BCC is good, but can't programs like Outlook etc view the BCC addresses too? Personally, if you're that concerned with privacy, I'd go with the loop were you know that there's no way of the addresses being leaked.
     
    Adventis, Aug 29, 2007 IP
  8. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Looping makes the email look more personal. Otherwise you can use the BCC field and create a fake to field (e.g., an email address at your domain that auto-deletes incoming email called "Secure Recipients"). Assuming your mail binary is set up correctly, the BCC field would not show up in the header.
     
    Gordaen, Aug 29, 2007 IP