In settings.py (or your settings module):

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'apikey'  # literal string, not your key
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = '[YOUR_VERIFIED_SENDER]'  # must be a verified sender

Set EMAIL_HOST_PASSWORD from the SENDGRID_API_KEY environment variable (for example with os.environ in settings, or your process manager). Do not commit the key in settings.py.

Checklist when mail does not go out:
1. EMAIL_HOST_USER is exactly 'apikey'. Using your email or key name here gives an auth failure.
2. TLS on 587, not SSL. Port 465 wants SSL, which Django's backend does not do with USE_TLS.
3. The from address is verified in the SendGrid console (domain auth or single sender).
4. In tests, use Django's locmem backend or sandbox mode so CI never sends real mail.