Skip to main content

BaseEmailBackend

Base class for email backend implementations.

Attributes

AttributeTypeDescription
aliasstring = NoneThe unique identifier for the mailer configuration used to initialize the backend.
_fail_silentlyboolean = FalseInternal flag determining whether to suppress exceptions during email delivery.

Constructor

Signature

def BaseEmailBackend(
fail_silently: Any = _NOT_PROVIDED,
alias: str = None,
_ignore_unknown_kwargs: list = None,
**kwargs: dict
)

Parameters

NameTypeDescription
fail_silentlyAny = _NOT_PROVIDEDWhether to suppress exceptions during email sending.
aliasstr = NoneThe alias name for the backend instance.
_ignore_unknown_kwargslist = NoneA list of keyword arguments to ignore during initialization.
**kwargsdictAdditional keyword arguments for backend configuration.

Methods


open()

@classmethod
def open() - > null

Open a network connection. This method can be overwritten by backend implementations to open a network connection.

Returns

TypeDescription
nullNothing is returned by the default implementation.

close()

@classmethod
def close() - > null

Close a network connection.

Returns

TypeDescription
nullNothing is returned.

send_messages()

@classmethod
def send_messages(
email_messages: list
) - > integer

Send one or more EmailMessage objects and return the number of email messages sent.

Parameters

NameTypeDescription
email_messageslistA collection of EmailMessage objects to be dispatched by the backend

Returns

TypeDescription
integerThe total count of email messages successfully processed and sent.