Integrate MailChimp with your Django App

*** Updated. For some reason, greatape has disappeared. I’ve updated this post to use MailSnake ***

Here’s a quick & easy method for integrating MailChimp into your next Django application.

1. Sign up for MailChimp <– this is an affiliate link. Sign up is free, but if you decide to upgrade to a paid account you will get a $30 credit by using this link.

2. Install MailSnake

sudo pip install -e git://github.com/bradwhittington/mailsnake.git#egg=mailsnake

3. Create a MailChimp API key by going to Account -> API Keys & Info

4. Use the MailChimp API for your emailing needs! Here is some example code to add a subscriber to your default list:

from mailsnake import MailSnake

ms = MailSnake('yourlongapikey-us1')
lists = ms.lists()
ms.listSubscribe(
    id = lists['data'][0]['id'],
    email_address = 'user@sample.com',
    merge_vars = {
        'FNAME': 'John',
        'LNAME': 'Doe',
        },
    update_existing = True,
    double_optin = False,
)

Find more information and to see available API calls, check out the MailChimp API documentation.

Why use MailChimp? You certainly don’t need to. You can roll your own email system in Django. But I highly recommend checking them out to make use of their awesome tools. They make it easy to set up templates, campaigns, auto-responders, etc. Plus, you can track statistics on the emails you send.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

June 21, 2010 · Dustin · 12 Comments
Tags: ,  · Posted in: Programming & Internet

  • http://github.com/ojii/django-mailchimp Jonas Obrist

    On topic, I wrote a similiar app but much more integrated into django, see http://github.com/ojii/django-mailchimp for details.

  • http://www.petersanchez.com/ Peter

    I noticed the “double_option=False” variable being passed. Does that mean they no longer REQUIRE double opt-in?

    When I was looking at aweber alternatives (that support API’s) I wanted to go with Mail Chimp or iContact, which both feature pretty awesome API support. The reason I had to turn away from Mail Chimp was the requirement for a double opt-in process.

    That doesn’t sit well when trying to segment a list from say prospects to buyers, etc. Maybe their policy has changed. I’ll have to look into this :)

    Thanks for the heads up!

  • http://www.nerdydork.com Dustin

    @Peter: That’s right. They now allow you to disable the double opt-in. It is set to True by default so you have specify this variable.

  • http://www.brainhood.net/ Jack Broadway

    hi, good post.. made for some good reading… :)

  • http://www.socoreenergy.com/ Randy

    This is a great way to program your site to be better optimized. Thank for sharing!

  • http://www.cxoclub.com/ Micheal Turner

    godd work, appriciate it… so when is the next post comin????

  • http://www.wiglingtonandwenks.com creative entrepreneur

    Good suggestions! No much effort required to do something like this and rehs

  • Sam@Denver limo

    yeah, Mailchimp very handy when you want to know who is reading your emails and so forth. It is a must for beginners and alike. I feel that I am getting the exposure for the business that I need with this program and others will too. You just can’t go wrong. The fact that you can be successful even as a free member is definitely a plus…”. I would surely like to integrate it.

  • http://www.transportationdenverairport.com Anderson@Denver Airport Limo

    Excellent! The only remaining questions about MailChimp for me were whether it has an integrated autoresponder and plugin for Magento. I read the autoresponder is coming soon and a Magento plugin is available! Woohoo! Can’t wait to get off Constant Contact!

  • http://www.matthew-oconnor.com Copywriter

    I’ve not heard of MailChimp before but will do some research and then maybe sign up. Thanks!

  • http://cribmattresshelp.com JohnD@Crib Mattress

    MailChimp is a great product. The tracking features it has are excellent. Thanks for the great post.

  • http://www.google.com krank

    The fact that you can be successful even as a free member is definitely a plus…”. I would surely like to integrate it.