Using Sendy with EECMS

I’m a big fan of the ExpressionEngine content management system (EEMCS). I haven’t found any system that is as flexible or, allows me to publish in a way that makes sense to me, the way EECMS does. Because of this ease of use, I’m always looking for opportunities to integrate it into my daily workflow. One of the ways that I’ve recently started using it is with Sendy, my email marketing product of choice.

With most email marketing services - think, MailChimp, CampaignMonitor, Constant Contact, etc. - the price you pay goes up as your subscriber list gets larger.

Let’s take MailChimp, for example. They have a free tier, which is very attractive, that gives you 2000 subscribers and up to 12,000 emails per month. What happens when you cross over the free threshold of 2000 subscribers or need to send more emails per month? Once you hit 2001 subscribers, you will then pay $30 per month. You will stay on this tier until you reach 2501, at which point you’ll start paying $35 per month. On the bright side, you do get unlimited emails as you move up from the free tier. Don’t like the idea of a monthly plan? MailChimp has you covered there as well. You can buy credits that vary from 2¢ to 3¢ per email, based on the number of credits you buy. The minimum is $30 in credits.

Admittedly, you do get some great features - specifically, easy to edit HTML email templates. This is especially great when you are trying to establish an email identity but once established, the variety of templates probably won’t matter that much. For example, I have a standard email template that I use for our weekly InThePanhandle.com newsletter. I’ve been using it for almost 300 weeks - 6 years - and in that time it has changed just a handful of times and very rarely since I found a template that I was satisfied with (i.e. worked well on both mobile and desktop). This was another factor in my decision to use Sendy.

Sendy?

What is Sendy? Sendy is a self hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES). Instead of subscribing to a service like MailChimp, you install Sendy on your own web server, create a template, create an Amazon SES account and then start sending emails through SES using the Sendy software. The instructions included with Sendy are easy to follow and once set up, sending is as easy as any other email marketing system.

Sendy Email Window

Cost?

The cost is the primary benefit. Sendy itself is sold like software - one time fee is charged and gives you all updates through the current version number - and costs $59. Again, this will be installed on your own web server so if you don’t have a web server(?) you will need a web server. Sending messages through Amazon SES are charged at $0.10 per 1,000. Yes, you read that correctly, 10¢ per 1000 messages.

Templates

As mentioned above, one of the primary advantages of Mailchimp et al., are the templates. If you are planning on only sending text-based newsletters as opposed to HTML-based, and there’s a strong argument for that strategy then you can get started right away. No need to mess with templates, simply use the plain text window and start typing. But, if you need a template, you have a bit more work to do.

This is the position I was in coming from CampaignMonitor. So, I started searching around for free HTML Email Template designs that I could modify and I found some great solutions ranging from the simple to the fully featured. You can check out the links below and find a good one based on your own needs. I ended up using Beefree.io which allowed me to build a template much like you would in Mailchimp.

Using Beefree.io with Sendy

Integrating with EECMS

My plan was to create an HTML email template, add it to my templates in my EECMS install, and then use a bit of code to pull events from two existing channels and a new channel called, The Weekly, that I created specifically for email newsletter content.

The Weekly channel would be used to create preheader text (which is very important), a headline, a sub-headline (which is generally a sentence or two with either a featured event or a bit of fun text related to what is going on locally), and a file field for a hero image.

Channels Used

  • Event Calendar which uses Solspace Calendar
  • News channel
  • The Weekly email channel which is made up of text fields and an Assets field

Events

My calendar is sent every Friday morning so I wanted to display a list of all events for the next seven days (Friday through the next Thursday). Using the following code, I am able to pull event titles, links to the event on the site and their date/time information.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<div id="wc_calendar">
{exp:calendar:cal enable="custom_fields" pad_short_weeks="y" dynamic="off" first_day_of_week="5" date_range_start="today" date_range_end="+5 days"
{if segment_3 == "by_calendar"}
{if segment_5 == ''}calendar_name="{segment_4}" date_range_start="0 weeks begin"{/if}
{if segment_5 != ''}calendar_name="{segment_4}" date_range_start="{segment_5}-{segment_6}-{segment_7}" date_range_end="{segment_5}-{segment_6}-{segment_7}"{/if}
{/if}
{if segment_3 != "by_calendar"}
{if segment_3 == ''}date_range_start="0 weeks begin"{/if}
{if segment_3 != ""}date_range_start="{segment_3}-{segment_4}-{segment_5}" date_range_end="{segment_3}-{segment_4}-{segment_5}"{/if}
{/if}
}
 
{display_each_week}
{display_each_day}
<div class="day">
<h2><a href="http://inthepanhandle.com/event/day/{if segment_3 == "by_calendar"}by_calendar/{segment_4}/{/if}{day format="%Y/%m/%d"}/">{day format="%l, %F %j, %Y"}</a></h2>
<ul>
{if day_event_total == 0}<li>No events for this day.</li>{/if}
{events}
<li class="event">
<a href="http://inthepanhandle.com/events/details/{event_id}/">{event_title}</a> {if event_all_day}(all day){if:else}{event_start_date format="%g:%i%a"}{if event_end_time != event_start_time && event_end_time != '00:00'} - {event_end_date format="%g:%i%a"}{/if}{/if}
</li>
{/events}
</ul>
</div>
<p>{/display_each_day}<br />
{/display_each_week}<br />
{/exp:calendar:cal}</p>
</div>

News

News entries were a bit easier to pull but it was difficult to figure out a way to specify which entries to pull based on what was used in a previous email. Arbitrarily, I decided to choose the last 15 news entries added to the site. I decided that if it was a slow week and we had fewer than 15 news entries, I would manually remove the entries that had been sent the previous week. So far, this hasn’t been an issue.

This is the code that I am using to pull the last 15 news entries.

1
2
3
4
5
6
<h2>Recent Articles</h2>
<ul>
{exp:channel:entries channel="news" orderby="date" offset="0" sort="desc" limit="15" dynamic="off" disable="categories|category_fields|member_data|trackbacks|pagination|custom_fields"}
<li><a href="{title_permalink=news/article}">{title}</a></li>
{/exp:channel:entries}
</ul>

Workflow

So, how does this all work in practice?

There is no way to automatically publish from EECMS to Sendy. It’s still a matter of copying and pasting the raw HTML into the Sendy HTML email window. But, I have simplified the workflow and created a preview window within EECMS through the creative use of add-ons and templates.

Two problems, one solution.

Having solved all of the problems related to templates and automatically pulling entries from the CMS, there were still two problems that I ran into in setting this system up.

  • How do I preview my emails before taking the time to paste them into Sendy?
  • How do I get the HTML source to paste into Sendy?

Enter Live View and Textarea.

Live View is an add-on for EECMS that allows you to preview your entry on one or more templates after submitting an entry. This add-on is really made for previewing your content at various screen sizes (ie., responsive testing) but I found that in addition to being able to test my emails on both mobile and desktop, I could create another view that included the source code that I would need to paste into my Sendy window! This was exciting.

To view the source code, I simply created a template and wrapped it with textarea and added it to Live View.

1
2
3
<textarea style="width: 100%; height: 100%">
…HTML Email source code with EECMS code…
</textarea>

By creating a mobile field, a desktop field and a source code field in Live View, I am able to preview the email and then copy the source code for use in Sendy. From there, it is simply a matter of following through with the process for sending the email via Sendy.

EECMS Entry Preview Window with Live View

Using this workflow has made the creation of weekly emails a painless process. Instead of manually adding events and news articles to an email template, I am now simply creating preheader text, headlines and finding images based on the theme of the week. A process that took up to an hour can now take as little as 5 minutes and I’m no longer paying for my monthly CampaignMonitor account.

⇠ Next Article Previous Article ⇢

About The Author

G. Brad Hopkins's avatar
  • G. Brad Hopkins
  • About Me: I bought my first computer - an Apple Performa 6320 - when I was in college and have been building websites ever since. These days I spend most of my time writing code and helping to bring interesting projects to life.
  • @gbradhopkins