Automatic Newsletter with Mailchimp and WordPress

Allowing users to receive the latest updates from our blog in WordPress is an extraordinary way to make them easier to follow up. Today, there are many ways for this to happen: we can use RSS readers that watch Twitter while waiting for a tweet to announce your last post, etc. But what if the subscribers of your web receive a mail automatically every time you publish an article? Or receive one weekly with everything you have posted? On the one hand, we make automatic the task of giving visibility to our posts, and on the other hand, we ensure that the information reaches our followers, who could miss it in the cascade of messages generated in the RSS.

In WordPress there are several plugins that allow us to send emails with our latest posts directly from the content manager, such as JetPack Subscriptions. But they have several limitations from our point of view, the most negative being that the sending of emails is done abundantly from our WordPress website, so it is likely to end up in the spam folder. We can add features like SMTP mail to increase delivery capacity, but it can be a cumbersome process. In addition to this, since WordPress is not a specialized mail platform, when sending emails in bulk we can use many server resources and end up slowing down our website.

So, the alternative that we are going to use is MailChimp, an email marketing provider. We talked you about it in this tutorial on how to create your first list of subscribers. Mailchimp servers are already configured to optimize the mail delivery on a massive scale, so it is less likely to be marked as spam. In addition, they have their own features that help us to comply with data protection legislation, and pre-designed e-mail templates that are not available in the plugins that we will find in WordPress. For all this, it will be our preferred option to automate this process. This is what we have configured in Silo Creativo and this is the Newsletter that our subscribers receive:

example-newsletter-mailchimp-wordpress

Getting the RSS feed of our WordPress blog for Mailchimp

WordPress automatically generates a RSS feed that includes all the entries of our blog. This will be all we need to integrate MailChimp with our WordPress. We will have two options:

– If we want the MailChimp’s newsletter to send an email every time there is a new publication regardless of the category or tag, our RSS feed will be http://our-domain.com/feed (our-domain.com would be the URL of our website).

– If we want the MailChimp’s newsletter to send an email when there is a new publication of a specific category, the RSS feed will be http://our-domain.com/category/node-of-category/feed (our-domain.com would be the URL of our website, and name-of-the-category, the name of the category to which the publication belongs.)

This is the aspect of a RSS feed; ugly right?

newsletter-rss-wordpress

Displaying featured WordPress images in the MailChimp newsletter

One of the main problems that we find when creating an automated campaign in Mailchimp is that the outstanding image that we assign to our posts is not shown in the emails that we send to our subscribers. This is so because by default the URL of the image is either not included in our RSS feed or Mailchimp is not able to interpret that data. Therefore, if you use outstanding images and want to take full advantage of them in your newsletter it is necessary to make an extra.

The goal is to include the highlighted image inside the Feed so that Mailchimp can interpret it. As Mailchimp is going to show the title and then the description or summary of the post, would not it be a good idea to always include the image at the beginning of the abstract? Let’s see two ways to do it.

The first is thanks to a simple function that you can include in the functions.php file of your WordPress theme or in a function file via plugin. For this we recommend creating a child theme, one of the safest ways to modify a theme in WordPress. The function that you must include is very simple, just retrieve the extract field, add the highlighted image and show it in the feed:

function silocreativo_thumbnails_in_feeds( $content ) {
global $post;
if ( '' != get_the_post_thumbnail() ) {
$content = '<p>' . get_the_post_thumbnail( $post->ID, 'full', array( 'style' => 'max-width: 100%; height: auto;', 'height' => 'auto' ) ) . '</p>' . get_the_excerpt();
}
return $content;
}
add_filter( 'the_excerpt_rss', 'silocreativo_thumbnails_in_feeds' );

Another way to achieve this is by using an external plugin, although for such a simple function it may not be worth it. We have this option or this one. Remember to try and send a test email before starting the campaign to check that everything works.

Configuring MailChimp to send automatic emails with our latest posts

First of all, we have to create an account in MailChimp. Both the creation of the account and the use of the service is free; although if we have a large number of subscribers or send a large number of emails, perhaps we should consider the option to pay the monthly subscription.

list-create-mailchimp

Once we have our account created, the first step will be to create a list. To do this, we will go to the Lists tab in the top bar, and we will access the list where all our lists are. If this is our first time in MailChimp this list will appear empty, so we will have to create a new list from the Create List button. Once we have entered all the data in our list, a window will appear from which we will manage our subscribers. If we already have a subscription list on our website, we can easily import it into MailChimp using a CSV file. This file can be created with any spreadsheet software, such as Microsoft Excel, and which must contain three columns: the first with the email address of our subscribers, the second with their names, and the third with their last names.

list-import-mailchimp

Once you have your CSV file, just click on Import subscribers inside MailChimp. Accept, and the list will be created! Keep in mind that MailChimp will not send an email notifying your subscribers that they are subscribed to this new list.

If you do not have any subscribers yet, do not worry. We will see also how to add a form in a WordPress blog, so that our readers can subscribe easily.

The next step will be to create a Campaign; in which we say that an email will be sent to our subscribers of the list that we just created with the last publication of our blog. For that we will click on Campaigns, in the top bar, and within the pull-down menu of the Create Campaign button, we will choose the RSS Campaign option. We will appear on a page called RSS feed and send timing, where we will add the RSS feed of our website, which we saw as the beginning of this article, and choose how much time, at what time, and what days we want the newsletter to send our latest publications. Once this is completed, we will go to the next page, where we will choose the list of subscribers to which the newsletter will go, which is the one we just created, and we will choose if we will send the whole list or just a group. In our case, it will be the entire list, since we want the maximum dissemination for our publications.

campaing-mailchimp

The next step, in Campaign info is to fill in the data that we are asked, like the name of the campaign or the email from which it will be sent. Once everything is ready, click on next, going to the Templates page, where we will have to choose the style of the template that will have the mail that we send to our subscribers. The ideal is to look for some that contain the word RSS, since they are the ones that will be designed especially for the type of mail that we are going to send. Anyway, we can modify this template to our liking in the next step, to adapt it to a design that is more even with the one of our web. Here you have some design tips on Newsletter. And this is it, with this we will have the campaign created addressed to our subscribers! We only have one more small thing to do.

Adding a subscription form to our WordPress blog

Once we have everything created, we need to create a subscription form, so that our readers will receive the newsletter with our publications. One of the ways to do this is through the typical form of Receive new blog articles by email in the sidebar of our blog.

There are several WordPress where we can add a form, although from inside the MailChimp Lists, in the section of Signup forms, we can design our own form and copy the URL that we will see in that same page and that we will paste in our blog of WordPress. Remember to give a good design to the subscribe button!

And once we have everything done, we will have no more to write in our WordPress blog, as MailChimp will take care of the rest. A good trick is to subscribe to our own newsletter to be sure that the email reaches all our followers in the day at the time we have programmed within MailChimp.

Comments (2)

  1. Hi everyone, it’s my first visit at this web site, and article is really fruitful for me, keep up posting such articles.

    1. Hi lasertest!

      Thanks for your words. We love that you liked the article. In the future we will try to publish some more of this subject.

      Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *