I've been tasked with replicating certain functions of a Joomla bulk mail plugin. Turns out this plugin nearly 50,000 lines of code with no comments. Rather than trying to replicate every single feature, I have decided to just try and hit the big features:
Can send very large numbers of marketing emails via SendGrid with some kind of flood control. I.e., send N emails every M minutes.
Can track delivery stats by user or newsletter or email type of some kind. The plugin has one page that offers these stats for each newsletter sent: email opens, number of emails where someone clicked a link, number of unsubscribe requests, forwarded, sent as html, sent as text, bounces, and failures.
Can tell if users are able to view email as HTML or only as plain text.
track clicks in email
* optimize emails to maximize delivery rates using DKIM or whatever other tools may exist.
Has anyone done this sort of thing before? Can you offers suggestions/tips/warnings?
I've been looking into the SendGrid Web API, Event API, and they also offer SMTP integration, although this appears to have fewer features. From what I can tell, I'm going to need a few things:
means of creating/automating/generating newsletters or email types as an email with an email_id
code to determine recipients for a particular email_id
code to contact SendGrid API and send the emails
some way to track if the email actually gets opened. I'm assuming this is accomplished by putting an IMG tag in the email that actually references a PHP script, once displayed, will tell me the user has viewed the email. Is there any other way? What is best practice here?
a url through which I can route email clicks. I.e., the email links to a url on my site that tracks the click and redirects the user to the link destination.
url to handle unsubscribe requests
How to determine when an email gets forwarded?
code to track how many outgoing emails are sent as html and text.
* code to parse API responses and/or receive Event notifications to track mail delivery failures and bounces.
Any insight you folks might have here would be much appreciated.