Integrate a newsletter into your website
Over the years I've been asked how to integrate a newsletter into a website quite a few times.
These days I often find myself recommending a third party service such as MailChimp, however I soon discovered that as brilliant as it is, MailChimp its not for everyone.
For example, many of our web hosting clients want to run their own mail campaigns through their own website rather than use a third party service.
What software should we use?
From memory there’s a few ways to do that:
- Mailman – Installed with cPanel
- PHPList – Install yourself or through fantastico, I’m not a fan
- Majordomo – Not installed
There’s quite a few other “free mailing list” solutions and there’s plenty of alternatives to Mailman, but Mailman is the preferred option for us, mainly because it’s reliable and established…
“cPanel currently uses Mailman, which is an open source product under the GNU Project”
It’s reassuring when software is used by a vendor such as cPanel, as you know it’s likely to be supported for the foreseeable future.
It’s really easy to get started with the Mailman Mailing Lists in cPanel, however there’s even a video tutorial if you’re a little unsure.
Tip: When you setup your mailing list call it “newsletter” so its purpose is easy to identify.
Now we’ve decided what software we’re using and we’ve setup our newsletter mailing list, we can now actually integrate it with our website.
When I first started looking into this, there wasn’t many ways to integrate Mailman using PHP, just an outdated article entitled How do I integrate Mailman with PHP, or any other web enabling technology?
Don’t worry about that, because we’re here to help…
Introducing the Mailman Widget for WordPress
What we want to achieve here is a widget on our website so users are able to subscribe to our newsletter.
If you’re using WordPress, this is no problem as we’ve got a WordPress Plugin to do it for you:
Simply login to your WordPress site as you normally would and go to the Add New Plugin screen. Just look for the “Mailman Widget”. If in doubt, take a look at the Mailman Widget screenshots to help you out.
Not using WordPress? Don’t panic!
We can use exactly the same library that’s used in the Mailman Widget on any PHP based website.
Simply download the file and take a look at the example to get you started.
The future of PHP Mailman
In future, using PHP Mailman should be even easier as it is turned into a PHP Pear package called Services_Mailman.
You can now download the Pear package via github:
Simply click the download button and extract the files. You can either require it like a normal class or install it as a Pear package by running the following:
pear install package.xml
Once the proposal for Services_Mailman has been passed, you should be able to simply do “pear install Services_Mailman” as it will be added to the Pear channel.
I hope this helps make it easier for you to add a newsletter to your website. Despite the rise of social media (such as twitter) email is still the number 1 way to communicate online, so it’s never been more important to keep in touch with your customers or peers.