pixeltrace Posted March 18, 2006 Share Posted March 18, 2006 guys,how can i set my email form in such a way that my$To = will be getting the emails (meaning many) from the database?i will be using it on my mailing list for sending newsletters.hope you could help me with this.thanks! Quote Link to comment Share on other sites More sharing options...
kayess2004 Posted March 19, 2006 Share Posted March 19, 2006 Hi,I wouldn't recommend putting all you mailing list members in the "To:"section. You should "Bcc:" them instead otherwise your whole list willbe visible to all of them.You could try this:[code]$sql = "select name, email from mailing_list";$result = mysql_query($sql);$bcc = "Bcc: ";while($row = mysql_fetch_array($result)){ $bcc .= $row['name']." ".$row['email'].",";}$to = "Me <myemail@myserver.com>";$subject = // Whatever your subject$body = // Whatever your body$headers = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";$headers .= 'You <youremail@yourserver.com>'. "\r\n";$headers .= '$bcc' . "\r\n";mail($to, $subject, $body, $headers);[/code]HTHSteve Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.