I'm often asked how to integrate MailChimp within your Drupal site. There are a few different options available, depending on what you are tying to achieve. MailChimp is a great resource for sending mass emails, whether just a newsletter, product update or notifications to registered users of an update to your site.
In this blog post I am going to describe a simple but common task of adding a user/visitor to your list on MailChimp. The list in this case is used for gathering users and adding them to newsletter list so that they can be sent a copy and receive vital updates. I have investigated various methods for integrating MailChimp and adding subscribers that are gathered on via a form on the website.
Before starting the research process I have set out a few key criteria that the plugin/module or method of integration should take. This is is always a good idea as it will help you narrow down the results when searching.
In this instance there are only a couple of small requirements:
- Add a subscriber to the correct list
- Sending Confirmation Email
There are a couple of options available to add MailChimp to your Drupal site. After searching the internet and the drupal.org website I have found that there is a module called MailChimp which is supported by MailChimp and partly developed by them. The second option which is is a little less flexible but can work in some of the simplest of use cases like the above mentioned, is embedded forms from MailChimp it self.
MailChimp Drupal Module
As the module page states, this module provides full integration with most of MailChimp's services including, mass mailing, campaigns and interaction with lists. As part of my research I installed the module as normal with Drupal but got an error about the MailChimp API not being found. After a bit of searching and reading it appears that for certain functions to work you need to add the MailChimp PHP library which is easy to find and documented as to how to install in the README.txt file with the module and comments and help is also available on the modules documentation.
Once the module was set-up and linked to MailChimp using the API Key generated by MailChimp. I was able to explore some of the features a bit more. As I soon discovered the module provided a lot of nice features easy to create and add blocks (areas on your drupal site), integrate with a variety of services provided by MailChimp. I then proceeded to set-up a simple form and integration with my list on MailChimp. This was relatively easy to do was the list had been added to Drupal as a configuration value, this also gave me options for the users of my site. A nice feature but a little more than I needed. It proved a little harder to style the form and the block area on the site that I had hoped. There also seemed a lot of options for just providing a form and a link to a subscribers list.
MailChimp Embedded forms
This is a very useful feature provided by MailChimp itself. You simply login to MailChimp and go to your list and select Signup forms. This will present you with an option to create various different forms for your user/customers to signup. I design my form and then created my form using the option for an embedded form. This was extremely easy to do and to customise my options. Once I had finished customising my options I read a bit more about how to style the form, which again was well documented and easy to do.
So I copied the provided HTML and created a new block on my test drupal site and added the HTML code. That was all I had to do to integrate the embedded form, this process will also work with pretty much any site. I then styled the form using my site's CSS. The end result was a much simpler and easier form styled to fit in with my site which takes the user to a simple confirmation page provided by MailChimp.
This is probably a good time to reiterate that these are my personal views and opinions! After having used both methods I decided to use the embedded approach to adding MailChimp to our site. However if I was creating/providing a community website where I had various different users and people using the site, then the MailChimp module would be a great way to keep the MailChimp lis tin sync and to make use of there email transaction service with ease.
So in conclusion all though for my particular needs this time around I chose a simpler approach. The chosen method here very much depends on your intended usage. There are many other MailChimp integration modules on Drupal all for different use cases.