Open main menu

User:X-Savitar/Sandbox/Draft Extension SparkPost

MediaWiki extensions manual
OOjs UI icon advanced.svg
SparkPost
Release status: experimental
Implementation Notify
Description Enables MediaWiki to use the SparkPost API for email distribution.
Author(s) Derick N. Alangi (X-Savitartalk)
Latest version 1.0
Compatibility policy master
MediaWiki 1.33+
PHP 7.0+
Database changes No
Composer sparkpost/sparkpost
License GNU General Public License 2.0 or later
Download
README
Translate the X-Savitar/Sandbox extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

The SparkPost extension enables MediaWiki to send emails through SparkPost's API service.

InstallationEdit

  • Download and place the file(s) in a directory called X-Savitar in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'X-Savitar' );
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension(). If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'X-Savitar' );, you need to use:

require_once "$IP/extensions/X-Savitar/X-Savitar.php";
You will have to run composer update in extensions/SparkPost/ folder so that composer can pick up and install the required SparkPost dependencies for the extension to run smoothly.

ConfigurationEdit

You need to have an account on https://www.sparkpost.com and a valid API key in order to successfully send emails via SparkPost using this extension. Getting an API key is really easy, just create an account and follow the steps, the last step will give away the API key plus, don't forget to verify your email (account after creation). See here for more information.

Security Warning: Do not paste your SparkPost keys directly in your SparkPost/extension.json as this will be a vulnerability making someone else to be able to use your account to send emails or perform other bad stuff.

With a valid API Key, configure your API key in LocalSettings.php :

$wgSparkPostAPIKey = "YOUR_API_KEY_HERE";

Test your settingsEdit

Go to Special:EmailUser and send an email to your own address to verify that the extension is working. You'll receive an email from the address you inputed and check to see if it's sent via the SparkPost API.