php - How to properly manage the sending of so many different bulk e-mails to the entire user base? -


one of php/mysql sites social network , need send many different e-mails, including:

1) event-based: e-mails sent when specific action occurs on user's account notify them (they received new message on site, friended them, posted on wall, etc).

2) periodic: e-mails sent on regular basis (e.g weekly list of people might know sent every saturday, monthly newsletter discussing new features of site, fortnightly list of new users in area, etc.).

with hundreds of thousands of users, how in world manage sending of e-mail, many users? how ensure e-mails don't blocked isp's? how handle unsubscriptions many different e-mail categories? how personalize e-mails each user? how ensure users don't bombarded many e-mails within 1-day, 7-day, , 30-day period? how integrate existing site?

i have amazon ses account 100,000 daily / 28 per second send limits.

how can use amazon ses handle of above? sounds incredibly overwhelming!

edit:

since interpreting question asking design e-mail management system me , downvoting question result, let me clearer: is there existing php/mysql script can handle needs above , integrate amazon ses , existing site? or need design such e-mail management system scratch?

my implementation give each user userid # (if haven't already), , have 2 tables (well, 2 main user tables). first users_main store basic info, uid, name, email, etc, etc, etc, , make 1 of fields 'notify' simple boolean true false, true meaning want receive event based notifications, , false meaning not. reason including in main database because you're going need info if want email, you'll have info cached.

the second table users_periodic or such. literally list of uids want newsletter, along info need send (for example columns might uid, email, name). when make query, select rows table. makes database lookups little easier.

ideally, believe run 2 separate servers/databases, because when runs, it's going suck entire i/o til it's done, fine if that's pretty server pull user stats, , make api or program sends user info when sign newsletter on email info server.

you rate limit this, little more complicated, basic implementation make sweeping sql queries whereby allocate program x mb of ram, , program loops , fills it's ram sql results (which mean needs rough way of approximating amount of ram query going take, , way know how many rows got, or next uid or something). issue here can't grab of them , retrieve values query 1 @ time because blocks database. have take of it, or take want , close query.

as far making sure don't many emails, daily relatively easy, make column emails sent today, have script check number before sends them email, make fetch increment value 1 , away go. make script resets values 0 @ midnight. weekly , monthly, wouldn't bother, going limited daily rate anyways, , you're going have track individual message dates make sure don't go over, it's not worth it.

as far people blocking you, have more or less no control on that. shouldn't blocked ses account, unless you're sending way spam. if blocked, there's not can it, you've made onto banned list, , you'll more or less have deal that. send them nice letters, don't think they'll care much, more or less want.

edit: in response edit, if have hundreds of thousands of users, aren't going want use premade. if you're talking sending many emails (with many users, you'll sending @ least hundred thousand emails day), you're going want custom tailor that's efficient setup, , setup sql accordingly. don't know of systems you, basic setup wouldn't awful in of easier scripting languages, although compiled c going run lighter on system.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -