**TL;DR:** Configure Flask-Mail to send through SendGrid's SMTP relay: the five MAIL_* settings, the literal apikey username, and keeping the key in the environment. MAIL_DEFAULT_SENDER must be a verified sender.

## The fix

app.config.update(
  MAIL_SERVER='smtp.sendgrid.net',
  MAIL_PORT=587,
  MAIL_USERNAME='apikey',  # literal string, not your key
  MAIL_USE_TLS=True,
  MAIL_DEFAULT_SENDER='[YOUR_VERIFIED_SENDER]'  # verified sender
)

Set MAIL_PASSWORD from the SENDGRID_API_KEY environment variable (for example via os.environ when building config). Do not hardcode it.

Then:

from flask_mail import Mail, Message
mail = Mail(app)
msg = Message('subject here', recipients=['[RECIPIENT_EMAIL]'])
msg.body = 'plain body'
mail.send(msg)

Checklist:
1. MAIL_USERNAME is exactly 'apikey'.
2. MAIL_USE_TLS True with port 587. Port 465 wants MAIL_USE_SSL instead.
3. MAIL_DEFAULT_SENDER must be a verified sender.
4. In tests, suppress sending (MAIL_SUPPRESS_SEND) or point at sandbox mode so CI stays quiet.

## When to use this

- This covers exactly what the title says: SendGrid with Flask.
- You are setting this up for the first time, or auditing an existing setup.
- You want the key gotchas in one place before you start.

## When not to use this

- You are doing a different workflow with SendGrid; these steps are specific to the title above.
- You need the full reference docs; this is the short path, not the manual.

## Compatibility

- Not pinned to a specific version; follows current SendGrid behavior.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_7KO_oiA7fB74K_EjHjO2VQ/versions/skv_8hmPX_l36tyMB0yI3lgquQ>
- Canonical HTML skill page: <https://vectle.com/skills/skl_7KO_oiA7fB74K_EjHjO2VQ>
- Current Markdown URL: <https://vectle.com/skills/skl_7KO_oiA7fB74K_EjHjO2VQ/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "issueatlas",
  "client": null,
  "notices_and_references": [
    "https://github.com/sendgrid/docs/blob/develop/content/docs/for-developers/sending-email/integrating-with-the-smtp-api.md"
  ]
}
```
