Need to send Newsletters to users with latest info about service.
Comparing SendGrid and Mailchimp as two most popular platforms to send emails, we choose Mailchimp as it is used especially for newsletters sending – not just mass email send.
After some research with mailchimp grails plugin we decide to write our own Service to use latest API with endpoints we need in the project.
Things we wanted to achive:
- Possibility to subscribe user with definition of his gender, age, city, country
- Possibility to choose ours predefined template with dynamic content
- Possibility to send newsletter based on gender, age, city, country
- Possibility to send newsletter to selected email list, which should be stored for SalesMan so that he can update/reuse it
We’ve added to Config.groovy similar fields that used in grails mailchimp plugin:
gchimp.apiUrl = 'https://us5.api.mailchimp.com/1.3/' gchimp.apiKey = 'sgsgsg34t2345sfgsgf-us5' gchimp.defaultListId = 'sgsgfsdg32' gchimp.salesListId = 'afssf2334'
To cover first two options we’ve updated login UI for user with subscribe to newsletter tick and other fields and created CRUD for Template creation. So, we always send template we want to use to Mailchimp in HTML format – never use theirs.
For all other needs we created Service to comunicate with Mailchimp
I won’t go in details through this service, but maybe somebody find there useful things