Using phpList for a blog's newsletter


Some people like to receive this blog via email. I previously used JetPack to send out subscriber messages - but it became increasingly clear that Automattic isn't a good steward of such things. I couldn't find any services which would let me send a few thousand subscribers a few emails per week, at zero cost.

So, redecentralise!

I installed phpList which is an open source email campaign tool. My webhost - Krystal - had a one-click install option. But, phpList isn't quite one-click for sending out a regular blog newsletter. I found the set-up to be quite confusing, so here are the steps I took to turn an RSS feed into an Email Newsletter for free.

Install the plugins

  1. Navigate to Config → Manage plugins
  2. Enable "CommonPlugin"
  3. Add the RSS Feed Plugin using the Plugin package URL https://github.com/bramley/phplist-plugin-rssfeed/archive/master.zip

Configure the RSS Feed Plugin

  1. Navigate to Config → Settings
  2. Scroll down to the RSS Settings
  3. Set both Minimum and Maximum number of items to 1
    RSS Settings Screen.
    That will ensure you only send the latest RSS item as your newsletter.
  4. Set "Use the item summary content (the description or summary element) instead of the content element" to "No". This will allow the full text of the RSS item to be sent.

Edit config.php

For some reason, you need to manually edit this file in a text editor, rather than a GUI.

  1. Set define('USE_REPETITION', 1); - this allows the newsletter to be sent whenever there is a new RSS item.
  2. Set define('CLICKTRACK', 0); - this removes tracking links from your emails. I don't care who opens my emails or what they click on.

Add The Campaign

  1. Go to Campaigns → Send a campaign.
  2. Start a new campaign.

Tab 1

  1. Campaign subject should be [RSSITEM:TITLE] - that will make the subject line the same as your post's title
  2. Compose message should be [RSS] - that will ensure the contents come from your RSS feed.

Tab 2

  1. Add your RSS feed's URl
  2. Order items "Newest" first - to get the most recent item.
  3. Add a custom HTML template. I used one from https://emailframe.work/
HTML HTML<div style="margin:0; padding:0; background-color:#F2F2F2;">
  <h1><a href="[URL]">[TITLE]</a></h1>
  <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F2F2F2">
      <tr>
          <td valign="top">
              [CONTENT]
          </td>
      </tr>
  </table>
</div>

Tab 3

  1. Send as HTML

Tab 4

  1. "Stop sending after" - choose the furthest date in the future possible.
  2. "Repeat campaign every" - I chose "hour". That should check the RSS feed each hour.

Tab 5

  1. "Lists" - pick the email list you want to send from.

Tab 6

  1. You should be finished! It will tell you if there are any errors.
  2. Place the campaign in the queue for processing.

WordPress Sign Up Form

You can either redirect users to your phpList subscription page, or put a form directly on your site.

HTML HTML<form method="post" action="/YourSubscribePage/?p=subscribe&id=1" name="subscribeform">
    <label for="email">Email address:</label>
    <input type="email" name="email" required="required" placeholder="" size="40" id="email">
    <input type="hidden" name="htmlemail" value="1">
    <input type="hidden" name="list[2]" value="signup">
    <input type="hidden" name="listname[2]" value="newsletter">
    <div style="display:none">
        <input type="text" name="VerificationCodeX" value="" size="20">
    </div>
    <input type="submit" name="subscribe" value="Subscribe">
</form>

Adjust the hidden parameters based on your list.

If in doubt, go to Config → Subscribe pages, and generate a new subscribe page. Then copy the form from that.

Cron Jobs

You need two cron jobs set up.

Update the RSS feed

I run this every hour:

/usr/bin/php /path/to/YourSubscribePage/admin/index.php -p get -m RssFeedPlugin -c /path/to/YourSubscribePage/config/config.php

Process the Queue

I run this a few minutes after the RSS feed is updated

/usr/bin/php -q /path/to/YourSubscribePage/admin/index.php -p processqueue -c /path/to/YourSubscribePage/config/config.php >/dev/null

And then...

That should be it. There are lots of options which you can fiddle around with. But the above should be enough to get your first newsletter out.

Huge thanks to Duncan Cameron for graciously answering my noddy questions and helping me out with the config.


Share this post on…

  • Mastodon
  • Facebook
  • LinkedIn
  • BlueSky
  • Threads
  • Reddit
  • HackerNews
  • Lobsters
  • WhatsApp
  • Telegram

2 thoughts on “Using phpList for a blog's newsletter”

  1. Sarah Taylor says:

    The HTML email I received is in a very small type size. Is there a setting you can do to make a larger default size?

    Reply
    1. @edent says:

      Cheers for the feedback - I'll play around with the settings.

      Thanks for reading.

      Reply

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.

Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">