I was wondering how the best way to do this would be...
Would you do it by having an admin account on the website where you can write the email and send from the admin account or is there a better way of doing it?
Thanks
Page 1 of 1
Sending Emails to all members
#2
Posted 25 January 2012 - 03:32 PM
adamsmith, on 23 January 2012 - 02:35 PM, said:
I was wondering how the best way to do this would be...
Would you do it by having an admin account on the website where you can write the email and send from the admin account or is there a better way of doing it?
Thanks
Would you do it by having an admin account on the website where you can write the email and send from the admin account or is there a better way of doing it?
Thanks
if your talking about having a database of users and there emails then the best way to do it would be by the while loop like
$message = "Message you are sending";
$result = $db->select("accounts","*","`accounttype`='2'",""); //db query
while ($row = mysqli_fetch_assoc($result)) {
$email = $row['email'];
$mailer->mail("$email", "$message"); /* whatever your mailer class is */
}
that would send a message to all the users whos accounttype is equal to 2,
obviously just that wouldnt work because you need the classes etc but it gives you a good idea
#3
Posted 25 January 2012 - 03:51 PM
I suggest a cron job that sends batches of 50 per 30 minutes, if you're talking about a large number of users.
#4
Posted 25 January 2012 - 05:31 PM
I don't do a lot of bulk emailing myself but this kind of question crops up quite a bit down in the lower levels of free web hosting where the rules are a lot more draconian.
Batching is essential and do find out exactly what your hosts mail sending policy actually is, because there will be a catch in there. A typical example of this is Hostgator, the big print reads 500 emails per hour, (oh goody 24hrs x 500 = 12000). However the small print says any mailing list with over 900 recipients has to be sent 'off peak' and any list over 5000 (as one list or several smaller together) and they will be tapping your credit card for a dedicated server or VPS upgrade.
SMTP via Gmail & Google Apps
will enable emails from somebody@mydomain.com to be sent using the Google mail servers but again there is limit of 500 per day (roughly 8 a minute) for a single account. If I recall you can boost this figure by enabling billing for the app engine, this raises the free quota threshold and lets you send 2000/ day without being charged.
Batching is essential and do find out exactly what your hosts mail sending policy actually is, because there will be a catch in there. A typical example of this is Hostgator, the big print reads 500 emails per hour, (oh goody 24hrs x 500 = 12000). However the small print says any mailing list with over 900 recipients has to be sent 'off peak' and any list over 5000 (as one list or several smaller together) and they will be tapping your credit card for a dedicated server or VPS upgrade.
SMTP via Gmail & Google Apps
will enable emails from somebody@mydomain.com to be sent using the Google mail servers but again there is limit of 500 per day (roughly 8 a minute) for a single account. If I recall you can boost this figure by enabling billing for the app engine, this raises the free quota threshold and lets you send 2000/ day without being charged.
#5
Posted 25 January 2012 - 06:59 PM
I never knew any of that, I just assumed it was free and you could send as many as you wanted... I'll look into that.
I'm gonna check out cron job too, how would you guys personally do it, would you use a cron job or would you just have an admin page where you can write an email and send to all users?
I'm gonna check out cron job too, how would you guys personally do it, would you use a cron job or would you just have an admin page where you can write an email and send to all users?
#6
Posted 31 January 2012 - 09:44 PM
adamsmith, on 25 January 2012 - 06:59 PM, said:
I never knew any of that, I just assumed it was free and you could send as many as you wanted... I'll look into that.
I'm gonna check out cron job too, how would you guys personally do it, would you use a cron job or would you just have an admin page where you can write an email and send to all users?
I'm gonna check out cron job too, how would you guys personally do it, would you use a cron job or would you just have an admin page where you can write an email and send to all users?
Again, as said above, that's not really a question that can be answered without knowing the amount of e-mails your sending. If you have 5 users and it won't increase then fine, but if it's a newsletter with 2000 subscribers you're going to need to batch the sending. A cron job would work, or use the sleep function within PHP and a while loop to achieve a similar thing to prevent it throttling the server.
Cheers
- ← Forms that return answers depending on input
- Server Side (PHP, Databases, ASP.NET, etc)
- retrieving information from database mysql →
Share this topic:
Page 1 of 1
Help





















