Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Send Campaigns from Drupal

Video loading...

  • 0:02
    Using MailChimp with Drupal 7
  • 0:04
    Send Campaigns from Drupal Series Sponsored by Mail Chimp
  • 0:09
    In an earlier tutorial, we looked at sending emails
  • 0:12
    from the MailChimp UI. Now, I want to look at sending
  • 0:15
    a campaign to our MailChimp list via Drupal.
  • 0:19
    In this tutorial, we'll enable the MailChimp Campaigns module
  • 0:23
    and send a campaign through the Drupal user interface.
  • 0:26
    We'll also talk about the various advantages and disadvantages of doing it this way
  • 0:30
    versus via the MailChimp UI.
  • 0:33
    The big wins being that your site's administrators don't have to know
  • 0:36
    anything about MailChimp. Instead, they can just do all their work right in Drupal.
  • 0:41
    As well as the ability to use a token-like syntax
  • 0:44
    to include the content of existing nodes on your Drupal site,
  • 0:47
    instead of having to copy and paste them, into your MailChimp email campaign.
  • 0:51
    In this tutorial, I'm assuming that you've already got a MailChimp list set up
  • 0:56
    with a few people on it that you want to send the campaign to
  • 0:59
    and that you're familiar with Drupal administration.
  • 1:01
    We'll be enabling some modules and using the Drupal admin UI
  • 1:05
    to send these campaigns.
  • 1:07
    By the end of this tutorial, you should be able to send
  • 1:09
    a MailChimp email campaign via Drupal
  • 1:12
    and understand the advantages and disadvantages of this approach
  • 1:16
    in order to help you best decide which method is the right one for you
  • 1:19
    and your team. So let's go ahead and get started.
  • 1:22
    The first thing that I'm going to do is actually create a piece of content
  • 1:26
    on our Drupal site. So, let's pretend that on our site
  • 1:29
    we've got the need to post articles or new press releases, we'll call them.
  • 1:35
    So I'm going to create a new article. Maybe talking about how
  • 1:38
    Anytown Ice Cream is adding a new location.
  • 1:43
    I will call this a press release, and I'm just going to insert some dummy content into it.
  • 1:48
    So I just pasted in some lorem ipsum. It probably doesn't need to be that long
  • 1:53
    so I'll trim it a little bit. But, here we go, I've now got a
  • 1:56
    a nice, short press release. I can add an image to this press release if I'd like to
  • 2:01
    so, we'll choose an image to go with it, upload the image,
  • 2:06
    we'll call it Vanilla; pretty standard, just creating a Drupal node.
  • 2:11
    Published. We don't need to promote it to the front page.
  • 2:14
    And save. So now we've got this hypothetical press release on our site.
  • 2:19
    And now we'd like to send out an email campaign
  • 2:22
    that includes this press release to our list of subscribers.
  • 2:25
    I'm going to go to the Modules tab and from there I'm going to scroll down
  • 2:29
    and locate the MailChimp campaigns module.
  • 2:31
    Let's scroll down, and enable this one: MailChimp Campaigns.
  • 2:35
    This is the one that will allow us to create and send MailChimp campaigns
  • 2:39
    from within Drupal. Let me click Save configuration.
  • 2:42
    Now, if I go to Configuration, MailChimp, under Web Services,
  • 2:48
    there's a new Campaigns tab up at the top here.
  • 2:50
    I can click on the Campaigns tab and from here
  • 2:53
    I can create a new email campaign that we'll send to our MailChimp-based mailing list,
  • 3:00
    but have it all done in Drupal. Before I do that, though,
  • 3:03
    I want to take a look at a couple of things that the MailChimp campaigns module added.
  • 3:07
    One of them, if I go back to Configuration and then I find the Text formats section,
  • 3:12
    is this new MailChimp campaign text format,
  • 3:16
    which currently has no roles configured to use it.
  • 3:19
    If you're using MailChimp campaigns you probably want to update this
  • 3:22
    and configure it so that the roles on your site have the permission to send
  • 3:26
    MailChimp campaigns, can also use this text format.
  • 3:30
    So, I'm just going to say administrators in this case, and save.
  • 3:35
    This special text format is provided by the MailChimp campaigns module
  • 3:39
    in order to allow for a token-like syntax where we can insert content
  • 3:43
    representative of a node on our site into an email.
  • 3:46
    We'll look at that again in a moment.
  • 3:48
    The other thing that we'll want to look at is the permissions for this.
  • 3:51
    So if you go to People, and then Permissions, scroll down the list until you find
  • 3:57
    the MailChimp Campaigns section and you'll see that it's one permission
  • 4:01
    Administer MailChimp campaigns. Anyone that has this permission
  • 4:05
    on your site will have the ability to create and send email campaigns
  • 4:10
    to your mailing lists. So, you want to be careful with that,
  • 4:13
    because this means that they can send an email to everyone on your mailing list.
  • 4:18
    We'll leave this set to Administrators. Great.
  • 4:21
    So now I'm going to go back and go through the process of creating a campaign.
  • 4:24
    If I go to Configuration, and then MailChimp under Web Services,
  • 4:28
    and the Campaigns tab, I can click on the Add a Campaign link.
  • 4:33
    This is going to bring up a form that will walk me through the steps
  • 4:36
    necessary to create an email campaign. I can give it a title,
  • 4:39
    we'll call this one Press Release. and give it a Subject,
  • 4:44
    Press Release - New Store; we'll make the title and the subject match.
  • 4:50
    Just for clarity in the future.
  • 4:52
    I can choose which list I would like to send it to.
  • 4:55
    The MailChimp campaigns module requires the MailChimp lists module
  • 4:59
    and the list module keeps track of the list that you have configured at MailChimp
  • 5:02
    that makes them available here within Drupal.
  • 5:04
    I'm going to choose the Weekly Newsletter list.
  • 5:06
    The module's pretty smart; it knows that I've got some segments for that list already,
  • 5:10
    however, I'm just gonna choose to send it to the entire list.
  • 5:14
    I can choose a "From" address and a "From" name.
  • 5:17
    The MailChimp campaigns module defaults these to whatever you have configured
  • 5:22
    in your Drupal system site information so this is the system email,
  • 5:29
    and the system site name. Leave them as is; that's fine.
  • 5:32
    So the email address that the campaign's going to be sent from
  • 5:35
    and the name that will appear associated with that email address.
  • 5:39
    And then I have to choose a template. So I get this big dropdown full of templates,
  • 5:43
    and it's the themes that are available within MailChimp.
  • 5:47
    I can choose a template, like, for example, Note. Let's see.
  • 5:52
    Let me find the note template. And it performs this request.
  • 5:56
    What it's doing is, it's getting a copy of that template from MailChimp
  • 5:59
    and then doing a little parsing to figure out
  • 6:00
    what are the sections of this template that can have content inserted into them?
  • 6:05
    So, this particular template has three sections where content can be inserted.
  • 6:09
    The header, the main content region, and the footer.
  • 6:12
    If I open up one of these, it shows me the dummy text that's in there
  • 6:17
    currently, and it allows me to edit that, if I would like to.
  • 6:20
    So, I could say, you know, just start changing the text here.
  • 6:24
    This is a really simple template. Some templates are a bit more complex.
  • 6:28
    So if I choose something like, for example, the Amazon Books template,
  • 6:33
    here we go; this one you can see has a whole bunch of regions that are editable.
  • 6:37
    Each one of these is the same: I tip it open,
  • 6:40
    I have the option to edit the text that will appear in that region
  • 6:44
    within our email.
  • 6:47
    I'm going to switch back to the note template
  • 6:48
    cause we're just going to stick to something simple for now.
  • 6:51
    If you're curious what any of these templates look like,
  • 6:54
    you can look at them in MailChimp. So if I switch to Mail Chimp,
  • 6:59, and log into my account,
  • 7:02
    if I go to Templates, and then I click Create Template,
  • 7:07
    and I go to Themes, so, select a starting point for your template,
  • 7:10
    you can see what all of these look like.
  • 7:12
    So, for example, the note template that we just chose,
  • 7:15
    is this one right here. And I can click on the thumbnail to get a preview
  • 7:19
    of what that's going to look like. This is a nice way to see
  • 7:21
    what those options in the Select list map to.
  • 7:24
    If I had created any of my own new templates,
  • 7:28
    those would also be available in most cases, in that dropdown list.
  • 7:33
    One thing to be aware of is that the MailChimp template creation tool
  • 7:37
    allows you to create drag-and-drop templates, or to code your own.
  • 7:41
    Due to the way that the MailChimp module works,
  • 7:44
    only themes from MailChimp, or Code Your Own templates
  • 7:49
    will be available in that dropdown list within Drupal.
  • 7:53
    In another tutorial, we'll look at creating a custom template
  • 7:56
    and making sure that we can see it within Drupal.
  • 7:59
    But for now, let's just stick with sending something with the Note template.
  • 8:02
    So if I switch back to Drupal, I've got the Note template available here,
  • 8:05
    it's got its regions, I can go ahead and edit any of them.
  • 8:08
    I'm going to edit the main region first.
  • 8:11
    Let's just delete all of the content that's currently here.
  • 8:15
    I want to show you a really cool trick.
  • 8:17
    If you go to Insert Site Content, what this will allow me to do
  • 8:22
    is choose an Entity Type, so I can choose the Node entity type,
  • 8:27
    and then select any entity of that type.
  • 8:30
    So we've got our press release that we just created earlier in this tutorial,
  • 8:35
    Let's see, what did we call it? Anytown Ice Cream Adds a New Location.
  • 8:38
    So I choose the piece of content that I would like to display.
  • 8:41
    And then I can choose a view mode. So these are Drupal's configured view modes.
  • 8:45
    Right now, these are just the basic ones,
  • 8:48
    but what'll happen is, I choose a view mode, I click Insert Entity Token,
  • 8:53
    I get this specially formatted token in the content area, here.
  • 8:56
    When I create this campaign, what it's going to do
  • 8:59
    is locate the specific entity, render it using the chosen view mode,
  • 9:04
    and insert the resulting HTML into the main section of this email campaign.
  • 9:10
    It's pretty cool. It also gives you some ideas about ways that you can maybe
  • 9:13
    create a newsletter, or MailChimp-specific view mode
  • 9:17
    for your article nodes that has a teaser that's appropriate for going into your newsletter
  • 9:21
    and then insert them this way.
  • 9:23
    So we'll do that. We can also inspect the header content.
  • 9:27
    We'll just leave that as is, looks good to me;
  • 9:29
    and the footer content, we can change this as well.
  • 9:33
    These are just the defaults provided by MailChimp.
  • 9:36
    I'll also point out that, you can see here it's using merge tags
  • 9:39
    in each of these different regions.
  • 9:41
    And it shows us a list of the merge variables
  • 9:44
    that we've got available for subscribers to our list.
  • 9:47
    So in our list, we're collecting their first name, last name, locations and birthday.
  • 9:52
    If I wanted to, I could include any of these pieces of information
  • 9:55
    in the template as well.
  • 9:57
    So, just by way of example, let's go up here,
  • 10:02
    into our main content, and I might also do something like first name,
  • 10:06
    last name, then I could do, edit this, we got to put a space between the two,
  • 10:12
    we'll move it up above the press release, and we'll say "Hello, [first name], [last name],"
  • 10:21
    "Here's some info about a new store we're opening." Insert content there.
  • 10:27
    Alright! Pretty cool! So, that't it for creating the campaign.
  • 10:31
    The text here, I'm going to say "Save as draft."
  • 10:35
    So, before I can send it, I need to save it as a draft.
  • 10:39
    Let me show you a couple of things. Once this is saved as a draft,
  • 10:43
    you can view a preview of it within Drupal.
  • 10:47
    That'll give you some sense of what the content's going to look like.
  • 10:50
    This demonstrates how it's rendering in the teaser of our press release node,
  • 10:55
    so that's pretty cool; we know that that's working.
  • 10:58
    I can also edit a campaign, so if I click here,
  • 11:02
    on the title, I have the option to, up in the top, click edit.
  • 11:06
    I can change anything about this campaign, up until the point at which I send it, of course.
  • 11:10
    Once it's been sent, you can't go back and edit an already sent email.
  • 11:14
    So, another thing I want to demonstrate is, if we switch over to MailChimp,
  • 11:21
    back in MailChimp, I'm just going to go to my MailChimp dashboard,
  • 11:24
    and I'm going to go to the Campaigns tab,
  • 11:26
    and you'll see that, what's happened is that the MailChimp module has saved this draft
  • 11:31
    within MailChimp, so I could also go here to Press Release
  • 11:36
    and make use of this campaign in the same way
  • 11:39
    that I would have if I had created it in the MailChimp UI.
  • 11:41
    I can do things like preview it, for example.
  • 11:44
    And I find this preview to be a little bit more helpful than the one in Drupal.
  • 11:48
    Though, here our images are broken; in this case that's because the image files
  • 11:52
    are located on my computer just on local host
  • 11:54
    so MailChimp doesn't have access to them.
  • 11:56
    But, you could assume that the image would show up.
  • 11:58
    It gives you an idea of what that would look like.
  • 12:00
    You can also send a test email from within MailChimp.
  • 12:04
    I'm just going to save and exit,like so and just go back to our dashboard there.
  • 12:08
    Anyway, if I switch back to Drupal, the campaign is still there in Drupal.
  • 12:13
    When I'm ready to send this, I can click the Send button.
  • 12:17
    So, over here, under Actions, I'll click Send,
  • 12:19
    "Are you sure you want to sent it?" Yes I'm sure.
  • 12:22
    Now Drupal has asked MailChimp to send this campaign on our behalf.
  • 12:27
    You could see how it's possible for someone to send an email
  • 12:30
    without ever actually having to leave the Drupal user interface.
  • 12:33
    Though I did want to also demonstrate what we just saw
  • 12:35
    that those drafts are saved in MailChimp so you can preview them that way as well.
  • 12:39
    Once the campaign has been sent, you'll notice that you can no longer send it again
  • 12:44
    which makes sense, cause you wouldn't want to send it more than once.
  • 12:47
    And you also can't edit the campaign after it's been sent.
  • 12:50
    So, you can view it, or you can see some stats about it.
  • 12:54
    The stats here will show you information MailChimp has
  • 12:57
    about when the campaign was sent and some other key metrics;
  • 13:01
    were there any bounces, were there any errors.
  • 13:04
    Our list is really small and they're all valid addresses
  • 13:06
    so I don't expect to see anything that interesting here.
  • 13:09
    But this will allow your users to see some of the same information
  • 13:13
    that they would be able to see in the MailChimp UI
  • 13:15
    but without having to leave Drupal, regarding statistics for this particular campaign.
  • 13:20
    So you can see, three of them were sent.
  • 13:23
    Finally, if I go back to the MailChimp Campaigns page,
  • 13:26
    you can also view an archived version of these at any time; so I can click that.
  • 13:31
    It'll take me to the MailChimp archive HTML example of the campaign that I just sent.
  • 13:37
    And that's what it looks like.
  • 13:39
    I wanted to take a second to talk about some of the pros and cons
  • 13:42
    of sending these MailChimp campaigns through the Drupal UI
  • 13:47
    versus sending them through the MailChimp UI.
  • 13:49
    Pros to sending them through the Drupal UI include
  • 13:52
    the ability to insert content from within Drupal.
  • 13:56
    We had that special token syntax that allowed us to insert our press release
  • 13:59
    right into the campaign. And this is a really powerful tool
  • 14:03
    especially once you start to take into consideration the fact that you could create custom view modes
  • 14:07
    for your content just for an email newsletter.
  • 14:10
    I also really like that it allows me to have one place for all editorial tasks.
  • 14:15
    So I could teach everyone on my team how to use Drupal
  • 14:18
    and they only ever have to use Drupal even to do things like send an email campaign.
  • 14:22
    They don't need to know how MailChimp works as well.
  • 14:25
    I also like that it creates a campaign record within Drupal.
  • 14:28
    So I can see a list of all the campaigns that were sent,
  • 14:31
    as well as some statistics and stuff, all right from within the Drupal UI.
  • 14:36
    The downside of using Drupal to send these campaigns
  • 14:38
    is that Drupal doesn't provide us with a way to send test emails.
  • 14:41
    Though, you can still log in to MailChimp,
  • 14:45
    once you've saved the draft of the campaign,
  • 14:47
    and send yourself a test email that way.
  • 14:48
    The preview in Drupal is a little bit limited.
  • 14:51
    It shows you the content, but it doesn't really show you how it's going to look
  • 14:55
    within an email client in the same way that MailChimp does.
  • 14:58
    And I do find that the user interface can be a little bit more tricky,
  • 15:01
    than that of the MailChimp campaign editor,
  • 15:05
    especially if you've got templates that have a lot of regions.
  • 15:08
    For a template like the Notes template, or a custom template that you build yourself
  • 15:12
    that maybe only has one or two regions, the Drupal UI can be very intuitive
  • 15:16
    and you can figure out how to make it work for your users,
  • 15:19
    but do be aware that it can get a little overwhelming
  • 15:22
    if you have a lot of regions.
  • 15:24
    So, the quick recap: in this tutorial, we took a look at
  • 15:27
    enabling the MailChimp Campaigns module, which will allow us to send email campaigns
  • 15:33
    to a MailChimp list from the Drupal user interface.
  • 15:36
    We talked a bit about when to use the Drupal user interface
  • 15:39
    versus when to use the MailChimp user interface
  • 15:42
    and sort of what the advantages and disadvantages are there,
  • 15:45
    and then we also went through the process of sending an email campaign
  • 15:49
    from within Drupal and showing how all of that works.

Send Campaigns from Drupal


In an earlier tutorial, we looked at sending emails from the MailChimp UI. Now let's look at sending a campaign to our MailChimp list via Drupal. In this tutorial, we'll enable the MailChimp Campaigns module, and send a campaign through the Drupal UI. We'll also talk about the various advantages and disadvantages of doing it this way vs. via the MailChimp UI. The big win is that your site's administrators don't have to know anything about MailChimp, instead they can just do all their work right in Drupal. There is also the ability to use a token-like syntax to include the content of existing nodes on your Drupal site rather than copy/pasting their content into MailChimp.

By the end of this tutorial, you should be able to send a MailChimp email campaign via Drupal, and understand the advantages and disadvantages of this approach in order to help you decide which method is best for you.

Further your learning

  • What additional permission(s) does the MailChimp campaign module add, and what do they allow?
  • What are the two primary advantages to sending email campaigns through the Drupal UI?
  • Explain the use case for the MailChimp text format. What does it allow that other text formats do not?
  • Further exploration: Can you use Views to create a list of archived/sent campaigns that is available to the public on your site?

Series Sponsored by MailChimp

Log in or sign up to download companion files.