My goal is to create a feature where our users can create email sequences and have them sent out at certain times. (think email marketing software like ActiveCampaign, MailChimp etc.)
How can I let the user schedule these in? Basically they would be creating cron jobs?
I need some thoughts on how to approach this.
So far I’m thinking:
User can create an email in our CMS, consists out of:
Subject
Preview line
Body
Sending date+time (they can’t set the ‘seconds’ online hours + minutes)
The user can fill this in, then it’s saved in the DB
I run a cron job every minute that checks if there’s any emails to be sent out at this date+time
Cron job sends emails to this user’s list
I’m not sure if this is smart, as this means there can easily be 100 000’s of emails to be sent in a minute. Let’s say a user has an average list size of 5000 people… this might be a huge burden on the server?
I do something similar. I’d recommend looking at using a third party platform to send the mails. I’ve used SindInBlue before but there’s a few around to evaluate.
A couple of things I’d recommend is storing the Mail body in a separate table to the recipient, date, sending complete flag, messageid etc, linked by foreign key. Also, think about batching messages with the same content and only storing one copy of the message body.
We chose for Mailgun - but haven’t set up much yet.
I now see they do have some scheduling/bulk sending features, so I can use that I suppose.
Good point on splitting the email body in a separate table.
I realise my question I have an answer to my OP, but not to what I really want to know: I basically have this same logic but then for Whatsapp reminders.