Building an email list for your business

A contact list is crucial for any business. So it makes perfect sense to compile a list of individuals who are interested in what your business has to offer. In this post we’ll talk through the compelling reasons for adding a newsletter subscription to your site and how it can be achieved on a wordpress set-up.

The reasons why
  1. Facebook et al will publish your content for free but you as a business owner have zero control over who sees that content when not paying for the privilege. A mail list gives you that control.
  2. Perhaps there is a specific time of year or season that a campaign must happen. With a mail list pick exactly when your campaign should be distributed.
  3. Subscribers are individuals who are genuinely interested in your business. By definition they are a more attentive audience.
  4. It’s possible to distribute e-newsletters for up to 2000 subscribers at zero cost with MailChimp
  5. Social Media platforms come and go but an email address is more stable. Once signed up, you have a much greater chance of retaining contact with that subscriber in the future.
Creating the list

First you need to go to MailChimp and sign up for a free account.

Then create a new List. You’ll need to provide the name of the list, the email address that the list originates from, the display name that the list originates from, a short explanation of how the recipient came to be on the list and your contact information.

All of these details are required to conform to anti-spam laws.

Installing the Form

MailChimp provides forms for you to copy and paste on to your site but as we’re all about flexibility, we’ll leverage their API to make our form exactly how we want it.

First you’ll need the API key and the Unique Id for your list.
For the Unique Id: Edit the List > Go to Settings > Among the various options you should find the ID

Newsletter ID

For the API Key: Go To Account > Extras > API Keys > Create A Key

Next up we’ll add a simple snippet of html to catch our user input, no form tag required here as we’ll use ajax to post the request to the server.

Then we’ll hook up our subscribe button in a javascript file to grab the email address and post a request to a method in our wordpress code. Notice I’m also passing through the wp_nonce_field value for authentication purposes.

Apart from some simple client-side validation and handling the server response that’s it for the client code.

Next we need to add a handler in WordPress to catch the subscriber request like so:

The server-side script is made super easy by using a PHP wrapper recommended by MailChimp. You can download it here.
Once you’ve downloaded the wrapper into your application you can finish off the server-side script by leveraging the wrapper like so:

That’s all there is to it. By leveraging the API you have all of it’s options at your disposal. If you use one of MailChimp’s pre-built forms these options are not editable. The ‘double_optin’ option, for example, is locked to true which forces subscribers to confirm their sign-up via email. As you can imagine this can be a bit of an obstacle to adding their subscription to your list.

In the next post we’ll look at setting up the email template ready for our first newsletter send out.

Post a comment

Go to Comments Permalink