Skip to content

init

__all__ = ['send_email'] module-attribute

send_email(content, subject, to_email=None, from_email=SG_FROM_EMAIL, client=None) async

Send an email using SendGrid.

PARAMETER DESCRIPTION
content

The email content.

TYPE: str

subject

The email subject.

TYPE: str

to_email

The email recipient.

TYPE: str | None DEFAULT: None

from_email

The email to send from (note: must be verified in SendGrid first).

TYPE: str DEFAULT: SG_FROM_EMAIL

client

The SendGrid client to use.

TYPE: SendGridAPIClient | None DEFAULT: None

RAISES DESCRIPTION
ValidationError

If emails/content are invalid.

HTTPError

If SendGrid API request fails.