How can I send an email to many at once?

Discussion in 'PHP' started by broken_mirror, Aug 16, 2006.

  1. #1
    hi
    I want to send an email to many at once. I do not want to put the queried elemets of an array one by one in an email() method
    is there any way?
    thanx
     
    broken_mirror, Aug 16, 2006 IP
  2. ravianz

    ravianz Notable Member

    Messages:
    1,536
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    250
    #2
    you dont need to put each address one by one;
    if you are sending email to one email then you will use one email address in 'to' parameter of the function like
    
    mail('caffinated@example.com', 'My Subject', $message);
    PHP:
    You can make a variable $to for doing it like this:

    
    $to = 'caffinated@example.com';
    mail($to, 'My Subject', $message);
    PHP:
    and for multiple users:

    
    $to = 'caffinated@example.com, email2@example.com, email3@example2.com';
    mail($to, 'My Subject', $message);
    PHP:
    for details: http://fr2.php.net/manual/en/function.mail.php
     
    ravianz, Aug 16, 2006 IP
  3. surefire

    surefire Guest

    Messages:
    40
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Many hosts disable the use of the php mail() function due to potential vulnerabilities if the code is poorly written.

    While not a cure-all, I recommend using phpmailer, a free class for sending mail by mail(), smtp, qmail, or sendmail. Available at phpmailer.sourceforge.net
     
    surefire, Aug 16, 2006 IP
  4. aRo`

    aRo` Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    aRo`, Aug 16, 2006 IP
  5. Blanket

    Blanket Peon

    Messages:
    409
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    why not use the bcc function in outlook.
     
    Blanket, Aug 16, 2006 IP
  6. smallbizstartupkit

    smallbizstartupkit Well-Known Member

    Messages:
    163
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #6
    I would also recommend using phpmailer as it is more secure and easier to implement especially for complex tasks.
     
    smallbizstartupkit, Aug 17, 2006 IP