Jump to content

擴展:SendGrid

From mediawiki.org
This page is a translated version of the page Extension:SendGrid and the translation is 15% complete.
MediaWiki擴充功能手冊
SendGrid
發行狀態: 穩定版
實現 通知
描述 Enables MediaWiki to use the SendGrid API for email distribution.
作者 Derick Alangi (X-Savitar留言)
最新版本 4.0
相容性政策 快照跟隨MediaWiki發布。 master分支不向後相容。
MediaWiki 1.39+
PHP 7.4+
Composer sendgrid/sendgrid
授權條款 GNU通用公眾授權條款2.0或更新版本
下載
README
  • $wgSendGridAPIKey
季度下載量 6 (Ranked 128th)
前往translatewiki.net翻譯SendGrid擴充功能
問題 開啟的任務 · 回報錯誤

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

安裝

  • 下載檔案,並將解壓後的SendGrid資料夾移動到extensions/目錄中。
    開發者和代碼貢獻人員應從Git安裝擴展,輸入:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/SendGrid
  • 將下列程式碼放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'SendGrid' );
    
  • Yes 完成 – 在您的wiki上導覽至Special:Version,以驗證��成功安裝擴充功能。
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.

Configuration

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.

警告 警告: 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"
];


測試你的設定

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