Answer the question
In order to leave comments, you need to log in
Database schema for email campaigns (schedule)?
Let's say there is a list of users, a list of articles, and these articles are grouped several times into a specific email newsletter, by topic.
I need to create a table in which I can specify how often to send email data in each of the email newsletters. Newsletter starts after the user has subscribed. A new user has subscribed - mailing has begun.
For example, in subscription1, soaps will be sent like this:
* Day 1 - 1st email
* Day 3 - 2nd email
* Day 4 - 3rd email
* Day 9 - 4th email
....
And in subscription2 it could be and so:
* Day 1 - 1st email
* Day 1, 3 hours after prev. soap - 2nd email
* 2nd day - 3rd email
* Day 2, 12 hours after prev. soap - 4th email
* 12th day, at 14:00 UTC - 5th email
---
That is, the intervals can be in hours, days, weeks, months. And, you need to be able to set what time of day to send email.
Question: How would I encode this table with the schedule in the database?
Just keep "offset in hours from previous_email"? Not convenient, because the mailing list can contain, say, 100 emails.
I would like to be able to code the schedule by:
a) hours (1st wash - immediately, 2nd - after 3 hours, 3rd - 8 hours after the 2nd ...)
b) or by day (1st wash - 1st day, 2nd - 3 days after the second, 3rd - 12 days after the 2nd ...)
c) or days and hours
d) or days, but with the possibility of specifying the time of day (on the 3rd day at 14:00) e) or weeks ... etc.
Flexible, that is.
Answer the question
In order to leave comments, you need to log in
I propose to save a specific date and time of mailing to a specific user in the schedule table. In order not to engage in complex calculations during the mailing itself.
And for the convenience of creating mailing lists, make a separate table with templates. More precisely, two tables - the template itself and its lines with the schedule. There indicate the offset and other details.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question