Ana içeriğe geç

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. See 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:

    FieldDescription
    Secret KeyYour SendGrid API key
    From AddressVerified sender email or domain
  4. Optionally, change the defaults:

    FieldDefault
    Endpoint/v3/mail/send
    Hosthttps://api.sendgrid.com
  5. Optionally, fill in the remaining fields:

    FieldDescription
    From NameSender display name
    Email TitleSubject
    Email ContentBody (HTML supported)
    Test EmailRecipient for 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​