# SendGrid

> Page: https://docs.plotwork.dev/connectors/sendgrid. Index of every page: https://docs.plotwork.dev/llms.txt

Send your organisation's email through your own SendGrid account, Twilio's email service, from an address on your domain. SendGrid's restricted API keys can be limited to sending mail and nothing else.

## TL;DR

| Question | Answer |
|---|---|
| What do I need? | A SendGrid account with your domain authenticated. |
| Which key? | A restricted API key whose only permission is to send mail. |
| Where does Plotwork send? | `https://api.sendgrid.com/v3/mail/send`, with the key as a bearer token. |
| Is this the Twilio option? | Yes. Twilio's email is SendGrid; choose SendGrid in Plotwork. |

## 1. Authenticate the domain at SendGrid

1. In the SendGrid dashboard, open the sender authentication settings and authenticate your domain. It must be the same domain you verified in Plotwork, such as `acme.com`.
2. Publish the DNS records SendGrid shows, usually CNAME records for DKIM and the return path.
3. Wait until SendGrid shows the domain as verified.

Authenticate the whole domain rather than one sender address: Plotwork may send from any address you set on it.

## 2. Make a send-only API key

1. In the SendGrid dashboard, open the API key settings and create a key.
2. Give it a name that says what it is for, such as `Plotwork`.
3. Choose restricted access, and give it the permission to send mail only. Leave every other permission off.
4. Copy the key. SendGrid shows it once.

## 3. Fill in the connector

| Field in Plotwork | What to enter |
|---|---|
| Provider | SendGrid |
| API token | The key from step 2 |
| From address | An address on the authenticated domain, such as `plotwork@acme.com` |

Then send a test from the Connectors tab.

## If the test fails

| Answer | Likely cause |
|---|---|
| The provider did not accept the token | The key was revoked or mistyped, or it lacks the permission to send mail. |
| The provider refused the email | The domain is not authenticated at SendGrid, or the From address is on another domain. |
| The provider could not be reached | SendGrid is down or slow. Try again later. |

## See also

| Page | Why |
|---|---|
| [Email through your own domain](https://docs.plotwork.dev/connectors/email.md) | Every step, including verifying the domain in Plotwork |
| [Connectors](https://docs.plotwork.dev/connectors/overview.md) | Which email goes through the connector |
| [How your token is protected](https://docs.plotwork.dev/connectors/security.md) | How Plotwork keeps the key |
| [SendGrid documentation](https://www.twilio.com/docs/sendgrid) | SendGrid's own guides to domain authentication and API keys |
