Emails
The django-logikal
library provides the Email
class as the main
interface for sending emails.
- class django_logikal.email.Email(template: str, context: dict[str, Any] | None = None, prefix: str | None = None)
Create an email based on a template.
Note
Requires the dynamic extra and a valid Anymail configuration.
Tip
We recommend using the standard dynamic site settings module, which configures the Amazon SES Anymail ESP with the standard Stormware AWS authentication process.
- Parameters:
template – The template to use.
context – The context to use for template rendering.
prefix – The prefix to use for the subject. Defaults to the value of the
EMAIL_SUBJECT_PREFIX
setting. Note that a space is automatically appended to the provided value.
Template
Tip
We recommend extending the standard email base template.
Blocks
- subject
The email’s subject (required).
- text
The plain text version of the email (optional). Defaults to the Markdown version of the rendered HTML content.
Functions
Methods & Properties
- attach(filename: str | MIMEBase, content: Any | None = None, mimetype: str | None = None) None
Create a new file attachment and add it to the message.
See
attach()
indjango.core.mail.EmailMessage
.
- attach_file(path: str | Path, mimetype: str | None = None) None
Create a new attachment using a file from the filesystem.
See
attach_file()
indjango.core.mail.EmailMessage
.
- send(*, sender: str, to: Sequence[str], cc: Sequence[str] | None = None, bcc: Sequence[str] | None = None, reply_to: Sequence[str] | None = None) int
Send the email.
- Parameters:
sender – The sender’s address.
to – A list of recipients.
cc – A list of carbon copy recipients.
bcc – A list of blind carbon copy recipients.
reply_to – A list of addresses for replies.
- property status: AnymailStatus
Return the status of the email.