December 10, 201015 yr Hello, Im sure you have answered this question many times but here goes, I want to add a subscribe feature to my blog, so when something new gets posted, Anyone who is subscribed to my list will recieve an email, but how would i email all the users effectivly, Would i use a foreach loop? foreach($emails AS $email) { mail($email... and so on.. } Is this the correct way to do it?
December 10, 201015 yr Hello, Im sure you have answered this question many times but here goes, I want to add a subscribe feature to my blog, so when something new gets posted, Anyone who is subscribed to my list will recieve an email, but how would i email all the users effectivly, Would i use a foreach loop? foreach($emails AS $email) { mail($email... and so on.. } Is this the correct way to do it? Yes this will email all subscribers in ur database
December 10, 201015 yr Author Yes this will email all subscribers in ur database Ahh brilliant once again you have helped me thanks mate
December 10, 201015 yr Hello, Im sure you have answered this question many times but here goes, I want to add a subscribe feature to my blog, so when something new gets posted, Anyone who is subscribed to my list will recieve an email, but how would i email all the users effectivly, Would i use a foreach loop? foreach($emails AS $email) { mail($email... and so on.. } Is this the correct way to do it? Well scratch that actually it should work but the best way prob would be while($row= mysql_fetch_array($query)) { $email = $row['email']; $message = $row['message']; $subject = $row['subject']; mail($email,$subject,$message,$headers); }
December 11, 201015 yr If your database of subscribers is 500 or 1000 and your email code just selects all of them to send at the same time, your hosting service or ISP may block them. Somehow you probably need to set a limit, say 30, which is fairly easy to do in PHP but then how do you set up the next sequence? I don't know. Also you may need another field in your database to deselect some of them, perhaps those who haven't visited your blog for over a year or any other reason you can think of.
Create an account or sign in to comment