API

Anything documented here is part of the public API that Flask-Email-Simplified provides, unless otherwise indicated. Anything not documented here is considered internal or private and may change at any time.

class flask_email_simplified.EmailExtension(app=None)

Flask extension that manages sending email messages with the Email-Simplified library.

Parameters:

app (App | None)

init_app(app)

Configure the extension with the given Flask application.

Imports the handler class identified by EMAIL_HANDLER using get_email_handler(). Calls from_config() to create a handler instance. Config is any key prefixed with EMAIL_ with the prefix removed and the key converted to lower case.

This extension is added to Flask.extensions with the "email" key.

When Flask.testing is True, the handler will always be TestEmailHandler unless EMAIL_TESTING_KEEP_HANDLER is True.

Parameters:

app (App)

Return type:

None

property handler: EmailHandler

The email handler associated with current_app.

When not in an active request or CLI command, an app context must be pushed manually.

send(messages)

Send one or more messages with the email handler associated with current_app.

Messages should typically be Message instances. However, they may also be email.message.EmailMessage instances for cases where a non-standard MIME construction is needed.

Parameters:

messages (Message | EmailMessage | list[Message | EmailMessage])

Return type:

None

async send_async(messages)

Send one or more email messages, as with send(), in an async context. May not be implemented by some handlers.

Parameters:

messages (Message | EmailMessage | list[Message | EmailMessage])

Return type:

None