From mediawiki.org
This page is a translated version of the page Extension:SendGrid and the translation is 10% complete.
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Release status: stable
Implementation Notify
Description Enables MediaWiki to use the SendGrid API for email distribution.
Author(s) Derick Alangi (X-SavitarDiskussion)
Latest version 4.0
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.39+
PHP 7.4+
Composer sendgrid/sendgrid
License GNU General Public License 2.0 or later
  • $wgSendGridAPIKey
Quarterly downloads 12 (Ranked 158th)
Translate the SendGrid extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

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


  • Die Erweiterung herunterladen und die Datei(en) in ein Verzeichnis namens SendGrid im Ordner extensions/ ablegen.
  • Folgenden Code am Ende Ihrer LocalSettings.php hinzufügen:
    wfLoadExtension( 'SendGrid' );
  • Yes Done – Zu Special:Version in dem Wiki (bei Einstellung auf deutsch nach Spezial:Version) navigieren, um die erfolgreiche Installierung der Erweiterung zu überprüfen.

Für Benutzer, die MediaWiki in der Version 1.24 und früher betreiben:

Die oben stehenden Anweisungen beschreiben die neue Installationsanweisung für diese Erweiterung unter der Verwendung von wfLoadExtension(). Wird diese Erweiterung in einer dieser früheren Versionen (MediaWiki 1.24 und früher)  – an Stelle von wfLoadExtension( 'SendGrid' ); – installiert, benutzen Sie:

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


You need to have an account on www.sendgrid.com and a valid API key in order to successfully send emails via SendGrid using this extension. Instructions to generate an API key can be found in the SendGrid API key documentation.

Warning Warning: Security Warning: Do not put your SendGrid API key directly in the SendGrid/extension.json as this will be a vulnerability allowing someone else to be able to use your account/key to send emails or perform other bad stuff.

Configuration on MediaWiki-Vagrant

Once your MediaWiki-Vagrant environment is setup correctly, do the following to get SendGrid to work properly with your new environment;

  • On your terminal, run: vagrant roles enable sendgrid.

In your SendGrid account settings, generate an API key. With a valid API Key, configure your API key in LocalSettings.php :

$wgSendGridAPIKey = "YOUR_API_KEY_HERE";

If you're using this extension with SMTP, make sure to configure your SMTP like below:

$wgSMTP = [
      'host'=> "smtp.yoursmtp.org",
      'IDHost'   => "yourhost.org",
      'port'     => 587,
      'auth'     => true,
      'username' => "yourSMTPusername",
      'password' => "yourSMTPpassword"

Test your settings

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 SendGrid API (for example; Your Name example@domain.com via sendgrid.net ).

Usage by production wikis

This extension is used by wikis listed here: https://wikiapiary.com/wiki/Extension:SendGrid (via WikiApiary)

Errors or exceptions

If your email fails to send and throws an exception, make sure that $wgPasswordSender matches the email sender identifier used in your SendGrid account.

Notice the change here: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/SendGrid/+/833121