# SendGrid email (not used for sending yet)

SendGrid appears on PiGi's Integrations screen and can store and check a SendGrid API key, but PiGi never sends through SendGrid. Email goes through PiGi's service, or your Custom SMTP server if you connect one, so you don't need a SendGrid account.

Source: https://help.pigi.io/guides/integrations/communication/sendgrid

## Quick answers

**Do I need a SendGrid account to send email from PiGi?**
No. PiGi never sends through SendGrid. Email goes through PiGi's service, or your Custom
SMTP server if you connect one. Choose **Built-in** on the **Email** card under
**Settings → Communication → Notifications → Methods**.

**I connected SendGrid — is my email going through it?**
No. PiGi can store a SendGrid API key and check that SendGrid accepts it, but PiGi never
sends through SendGrid. Email goes through PiGi's service, or your Custom SMTP server if
you connect one.

**I picked SendGrid on the Email card. Did that change anything?**
No. PiGi never sends through SendGrid, whichever provider the Email card shows. Email
goes through PiGi's service, or your Custom SMTP server if you connect one.

**Why does Test connection fail with a key that has Mail Send permission?**
PiGi's check reads your SendGrid account details, which a key limited to Mail Send may
not be allowed to do. As SendGrid isn't used for sending yet, there is no need to fix
this.

**PiGi shows a SendGrid warning in the header. Is my email affected?**
No. The warning appears when a saved SendGrid key fails its check, and it says so: your
email notifications are not affected, because PiGi does not send through SendGrid. Fix the key and press **Test connection**, or disconnect the SendGrid tile to
clear the warning.

**Can emails come from my school's own address?**
Yes, but through Custom SMTP, not SendGrid. Connect **Custom SMTP** with your mail
server's login and, on the live PiGi site, customer emails go out from your **From
Email**. See [Send customer email through your own mail server](custom-smtp.md).

## What this is

SendGrid is an email delivery service from Twilio. PiGi lists it as **SendGrid Email**
under **Communication** on the Integrations screen, ready for a time when schools can
send through their own SendGrid account. That isn't switched on yet.

## Current status

- **What works:** you can connect the tile, save an **API Key** and run **Test
  connection**. A pass shows "API key valid".
- **What doesn't:** PiGi never sends through SendGrid. Booking confirmations, invoices
  and notifications go through PiGi's service, or your Custom SMTP server if you connect
  one.

## What to use instead

Use PiGi's built-in email, which needs no setup, or connect
[Custom SMTP](custom-smtp.md) to send from your own address. See
[Set up email sending](../company-setup/email-setup.md).

## Store and check a SendGrid key

Only do this if you want the key ready for later.

1. In SendGrid, create an API key under **Settings → API Keys**, as SendGrid's API keys
   page describes. Copy it when it is shown, because SendGrid shows it once.
2. In PiGi, open **Settings → Communication → Integrations**, click **SendGrid Email**
   and then **Connect SendGrid Email**.
3. Click **Add credentials**, paste the key into **API Key** (it starts with `SG.`), and
   save.
4. Click **Test connection**. "API key valid" means SendGrid accepted it.

## Known limitations

- **Not used for delivery.** PiGi never sends through SendGrid, whatever is chosen on
  the Email card. Email goes through PiGi's service, or your Custom SMTP server if you
  connect one.
- **Test connection needs a broad key.** A Mail Send-only key can report a failure even
  though it would be enough to send.

## Sources

- [SendGrid: API keys](https://www.twilio.com/docs/sendgrid/ui/account-and-settings/api-keys)
- [SendGrid: How to set up domain authentication](https://www.twilio.com/docs/sendgrid/ui/account-and-settings/how-to-set-up-domain-authentication)
