39 - Implementing a Mailing List in ExpressionEngine

The last piece of the puzzle on the Train-ee Church Site is implementing an email mailing list for the church to use in communicating with its members.

 
Download the EE Code for 39 - Implementing a Mailing List in ExpressionEngine

I know - if you’re reading this you’re probably not a fan of anything email based anymore.  RSS feeds, twitter, Facebook - surely there must be a better way for a church to communicate with its members than plain old email? 

I agree - but the plain and simple truth of the matter is that for many people email is their internet experience.  If your church has a variety of demographic groups you’ll probably need to still use email in order to reach all of them.

Luckily, with EE the implementation is straightforward, the list is double opt-in, and recipients can unsubscribe themselves.  Now - creating and sending out regular email missives is still no small task, but at least the list management is handled by ExpressionEngine.

Caveats
The EE Mailing List Module is overall a pretty simplistic tool - I’d say it’s a good one to use if your list is in the 100’s rather than the 1000’s and you’re sending out a few emails a month.  You don’t get to track metrics like open rates, etc - and while you can send HTML email there’s no direct way to use an existing EE template as the basis (although there is a 3rd Party Extension that adds that functionality). 

If your mailing list needs are more advanced then I’d recommend checking out Campaign Monitor and the CM Extension for EE.  As a sidenote, the Campaign Monitor site is itself an ExpressionEngine site, built by Newism - who is writing a series of blog posts about how the job was done.

OK-  back to the Church site.  Here are the steps required for the task at hand:

  • Make Sure the List is Enabled
  • Create the mailing list
  • Create a new template
  • Add the necessary tags to the new template
  • Test

Make Sure the List is Enabled
In the Control Panel under Admin ›  System Preferences ›  Mailing List Preferences - make sure the “Mailing List is Enabled” option is set to Yes.  This is also where you can set notification preferences such that an admin will be notified of new sign-ups to the mailing list.  This is nice if you want to send a more personal welcome message or just track the popularity of the list in general.

Create the Mailing List
The mailing list functionality of ExpressionEngine is a module, so to interact with it go to the EE Control Panel and select the Modules tab, then the Mailing List name.  From there:

  • Click Create New Mailing List
  • Fill in the Short Name - I specified “church_newsletter” - this value will be necessary later so make a note of it
  • Fill in the Full Name - I specified “Church Newsletter”
  • Click “Create”

Note that you can tweak some aspects of the emails that will get sent out - if you want a standard greeting, or each email to always have the church address, service times, and phone/fax number.  You can also change the language of the unsubscribe links etc.  To do this just find your mailing list in the list and click “Edit Template”.

Create a New Template
OK - back in the Templates area of EE let’s move forward with getting the subscription form on the site. 

While on some sites you may implement this subscription form as a sidebar or footer element, for this site it will just live on a dedicated template.  I created a “subscribe” template in the default “site” template group, choosing to copy page-comps/one-column-content as it include a newsletter subscription form.

Add EE Tags to site/subscribe
The new template will need the basics configured - page name, body id (which sets the picture that shows), etc - but I trust you’ll figure that out.  I want to focus on the core content of the page - the subscription form.

The sample code in the EE docs is a good starting point - so copy that and paste it into your template to work with.  Essentially you need to meld together the styling from the template subscribe form with the code from the EE docs - and the result is this:

{exp:mailinglist:form list="church_newsletter"}
    
<p><strong>Newsletter Sign Up</strong></p>
    <
p><input type="text" class="form" name="email" value="{email}" /></p>
    <
p><input type="image" value="submit" src="{site_url}images/interface/send-button.gif" /></p>
{/exp:mailinglist:form} 

Note that the short name of the mailing list that I created earlier is specified as a parameter in the opening tag.  EE lets you have multiple mailing lists, so this is how you tell EE which list to assign this email address to.

Also note the variable being used in the email text field:

value="{email}" 

The email value is a Global Variable and used as is it will default the contents of the email box to the email address of the currently logged-in member. If your site doesn’t use the EE Membership module for more than a content administrator or three, then this is probably unnecessary—but also harmless if left in.

Test Subscribing
With that code in place you should be able to load the rendered page and test the form.  Enter in an email address that you can check and submit - you should get a notification message, and then an email with a confirmation link in it.  Clicking that link should add your address to the list (note that you can manually remove it again back in the Mailing List Module Interface).

Test Sending
With an address on the list you should now be able to send a message out. Do this by navigating to the Communicate tab in the EE Control Panel.  Enter the basics of a message, select the proper Mailing List in the right column, and click Send It.  You should get an email a few minutes later and be able to unsubscribe yourself from it.

If you have any issues with the list not working I’d suggest reviewing the Email-related configurations in the EE CP:  Admin ›  System Preferences ›  Email Configuration, and checking with your webhost to see if what you’ve specified should work.  Here on Train-ee I have it set to use Sendmail and it works well.

Is It Over?
Unbelieveably almost a year after beginning this series I believe I have found the end of it!  This proved to be a much broader and deeper site than the Small Business Series - and it’s been quite a ride.

Cheers!

Category Navigation

<< Previous Entry   

 

Previous Comments

Picture of Mark Dowsett

by Mark Dowsett

Date: Thursday, March 12th, 2009
Comment: #1

This was great!  Well timed too as I see you just posted this last week.  I use other CMSs but was helping a client with his EE site.  I’ve never looked at the back-end of EE before but your instructions helped me get thru it VERY quickly….and it all worked!

Now I just want to accomplish sending out the newsletter as an HTML with some nice images and links and I’m all set!

Picture of Ty.G-ee

by Ty.G-ee

Date: Thursday, March 12th, 2009
Comment: #2

Wow the proverbial light at the end of the tunnel.
There are so many EE techniques rolled in to this series it’s such a valuable resource.
Thanks for rounding out this series Michael.

Will you be getting to go to SXSW this year, I wasn’t sure you’ld mentioned it anywhere?

Picture of joec

by joec

Date: Monday, March 16th, 2009
Comment: #3

Nice and simple. Now tell us how to get all of our existing email addresses from outlook to EE without copy and paste?? Pleas.

Mike Boyink

by Mike Boyink (Author)

Date: Wednesday, March 18th, 2009
Comment: #4

Hi Joec -

The other approach is to query them in at the MySQL level, but honestly I think the copy/paste process is going to be easier.

You did find the “Batch Subscribe/Unsubscribe” field under Modules > Mailing List?

Picture of Mark Dowsett

by Mark Dowsett

Date: Wednesday, March 18th, 2009
Comment: #5

Can anyone point me in the right direction to spruce up my newsletters by formatting them into HTML format?  (see comment #1 above)

Mike Boyink

by Mike Boyink (Author)

Date: Wednesday, March 18th, 2009
Comment: #6

Hey Mark -

What have you tried?  I haven’t done HTML newsletters for clients - but I think the general consensus is “code like it’s 1999”—meaning the only way to get consistent formatting in all the different email clients is to use tables and inline CSS.

Otherwise I’d investigate tying Campaign Monitor and EE together - and using one of CM’s prebuilt/tested templates.

Picture of Mark Dowsett

by Mark Dowsett

Date: Wednesday, March 18th, 2009
Comment: #7

I haven’t tried anything.  I’m rather new to EE.  I tried putting HTML code in the newsletter’s template and made sure it was sent out in HTML format in the newsletter’s settings but it didn’t work, it seemed to strip out all HTML.

I just want a ‘simple’ header and footer included with all newsletters that go out and to embed a small thumbnail image in the posts.

Mike Boyink

by Mike Boyink (Author)

Date: Wednesday, March 18th, 2009
Comment: #8

Huh…interesting.  Did you code a complete HTML page, or just try snippets of HTML?

Picture of Mark Dowsett

by Mark Dowsett

Date: Thursday, March 19th, 2009
Comment: #9

Snippets I suppose.  This is what I put:
http://slidefarm.com/images/SFheader.png

{message_text}

 

To remove your email from this mailing list, click:
{if html_email}here{/if}
{if plain_email}{unsubscribe_url}{/if}

Mike Boyink

by Mike Boyink (Author)

Date: Thursday, March 19th, 2009
Comment: #10

Eh - the HTML was swallowed up by the formatting here on Train-ee.  You can surround code with [ code] [ /code] tags (remove the spaces) and it will come through.

You might be better off with a post in the EE forums - but I suspect that you’ll need to code the entire email as HTML to get any to come through.

Picture of Mark Dowsett

by Mark Dowsett

Date: Friday, March 20th, 2009
Comment: #11

I’ll try again.

<a href="http://slidefarm.com"><img  src="http://slidefarm.com/images/SFheader.png"></a>
<
br><br>
{message_text}
<br><br>
To remove your email from this mailing list, click:
{if html_email}<a href="{unsubscribe_url}">here</a>{/if}
{if plain_email}{unsubscribe_url}{
/if} 

Can you offer a suggestion as to what needs to be added?

Mike Boyink

by Mike Boyink (Author)

Date: Monday, March 23rd, 2009
Comment: #12

I *think* you need to code the entire thing as an HTML page.

But again - this is an area I have not had to explore in EE - so a post in the EE forums is probably in order as well.

Picture of Edwin

by Edwin

Date: Sunday, May 1st, 2011
Comment: #13

Thanks for all this Mike.  I have learn a great deal just following this tutorial.

Picture of Christine

by Christine

Date: Thursday, November 3rd, 2011
Comment: #14

Is there a way to edit/revise the subscriber notices from the mailing list? i.e. The notice that they’ve been subscribed etc. We have two mailing lists in two languages, and want to be able to have language appropriate subscribe and unsubscribe e-mails.

Mike Boyink

by Mike Boyink (Author)

Date: Thursday, November 3rd, 2011
Comment: #15

There are templates for the email messages under Design > Message Pages > Email Notifications, but they are a one-size-fits all.

Picture of Steven Deustch

by Steven Deustch

Date: Friday, November 4th, 2011
Comment: #16

Do you know if it is possible to customize the Mailing List Sign Up responses?

After someone signs up for a list, they come to an empty page with grey box reading: “Thank you. You have been sent an email confirmation”.

Similarly, after a user clicks the link to confirm their email address, they are brought back to another page with a similar generic grey box informing them that ‘they were successfully added to the mailing list’.

I would like to customize both because otherwise they are like Internet dead ends. I just can’t seem to find a way to get at these messages, or even to embed them into a template.

Any thoughts would be helpful. I very much appreciate your help and your time.

Mike Boyink

by Mike Boyink (Author)

Date: Friday, November 4th, 2011
Comment: #17

Take a look at the Custom System Messages add-on:

http://devot-ee.com/add-ons/custom-system-messages

Add Your Comment

Commenting is not available in this channel entry.

Unless otherwise stated all content is © Michael Boyink of Train-ee.com & Boyink Interactive. Please don't steal - I've got kids to feed...

dy>