How can I email a long list of emails in my database?
I have this database table that contains emails like 300 records,
emails{email,name,join_date);
and I want to email all of them开发者_运维问答 something, how could I do this with php and mysql? thanks!
$myEmailMessage = "";
$sql=mysql_query("SELECT * FROM emails");
while($info=mysql_fetch_assoc($sql)){
mail($info['email'], 'My Email Title', $myEmailMessage);
}
Now you just need to set $myEmailMessage to whatever you want to send to your users.
If you need more advanced emails (html, attachments, etc), you can take a look here
精彩评论