Skip to main content

get_connection

Load an email backend and return an instance of it.

def get_connection(
backend: string = None,
fail_silently: boolean = False,
**kwds: dict
) - > BaseEmailBackend

Load an email backend and return an instance of it. If backend is None (default), use settings.EMAIL_BACKEND. Both fail_silently and other keyword arguments are used in the constructor of the backend.

Parameters

NameTypeDescription
backendstring = NoneThe Python import path to the email backend class to instantiate. If omitted, the EMAIL_BACKEND setting is used.
fail_silentlyboolean = FalseA flag passed to the backend constructor to determine whether to suppress exceptions during email operations.
**kwdsdictAdditional keyword arguments passed directly to the constructor of the email backend class.

Returns

TypeDescription
BaseEmailBackendAn instance of the specified email backend class, initialized with the provided keyword arguments.