WP Manifestindependent plugin directory
manifest / email / moylgrove-mailshot

Moylgrove Mailshot

Send email about upcoming events

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/alancameronwills/moylgrove-mailshot/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Moylgrove Events Mailshot - WordPress plugin

Creates a summary on MailChimp of events published on your website.

Built for https://moylgrove.wales

Website prerequisites

Assumptions about your WordPress site:

  • There is an event category which contains the posts to be included in the mails
  • The site's repertoire of image sizes includes medium
  • Each event is a post that has a title and a featured image
  • ACF is installed, and the following fields are used:
    • expires - Date after which the event is no longer displayed
    • dtstart - DateTime on which the event occurs
    • subtitle - string, may be empty
    • price - string, may be empty

Assumptions about your MailChimp account:

  • You've set up a separate folder for the emails generated by this plugin

Keys

Requires a file 'MailChimpKeys.php' (not on GitHub) that contains MailChimp keys:

<?php
class MailChimpKeys {
    protected const MailChimpKey = "XXXXX"; // API key provided by MailChimp
    protected const MailChimpAuthorization = "Basic YYYYY"; //Authorization: base64 rendition of x:{MailChimpKey}
    protected const MailChimpUrl = "https://ZZZZ.api.mailchimp.com/3.0/";
    protected const FolderID = "MMMMM"; // MailChimp campaign folder for these generated emails
}

Easiest way of getting MailChimpAuthorization is to use curl:

curl --headers https://ZZZZ.api.mailchimp.com/3.0/ping --user x:XXXXX

where 'x' can be anything, including just 'x', and XXXXX is the MailChimpKey.

Look at the request header that curl sends, and copy the Authorization header.

Usage

Set up a page that won't be visible to the public - e.g. a post with "Uncategorized" category or Draft status.

Include in it a shortcode:

[ moylgrove_mailshot ]

View the page and you'll see a version of the email that will be generated.

Refresh the page with a query appended to the URL:

  • ?test=1 - Will send a test email
  • ?send=1 - Sends to the default audience of the MailChimp account. Also deletes all previous mails in the folder.
  • ?ping=1 - Tests the connection to MailChimp