跳到主内容

Send email with SendGrid

This guide explains how to send the emails of Casdoor through the API of SendGrid.


Learning outcomes​

  • Create a SendGrid API key and verify a sender.
  • Add SendGrid as an email provider in Casdoor and test it.

What you need​

  • A SendGrid account
  • Administrator access to the Casdoor admin console

Prepare SendGrid​

  1. In the SendGrid dashboard, go to Settings > API Keys, click Create API Key, and select the permissions that you need. Copy the key.

    API key creation in SendGrid

  2. Verify your sender with Single Sender Verification or Domain Authentication. 见 Sender Identity。

Add the provider in Casdoor​

  1. In the Casdoor admin console, go to Identity > Providers and add a provider.

  2. Set Category to Email and Type to SendGrid.

  3. Fill in the required fields:

    字段描述
    密钥你的 SendGrid API key
    发件人地址已验证的发件邮箱或域名
  4. Optionally, change the defaults:

    字段默认值
    端点/v3/mail/send
    主机https://api.sendgrid.com
  5. Optionally, fill in the remaining fields:

    字段描述
    发件人名称发件人显示名称
    邮件标题主题
    邮件内容正文(支持 HTML)
    测试Email配置Send Testing Email 的收件人

    SendGrid provider in Casdoor

  6. Save the provider.

Verify the result​

Click Send Testing Email and check that the message arrives at the Test Email address.

See also​