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
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
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
I use this php function to send mail so i does not get blocked by hotmail etc. http://www.codehomepage.com/php/how-to-send-mail-without-getting-caught-by-a-spamfilter/
I would also recommend using phpmailer as it is more secure and easier to implement especially for complex tasks.