General utility functions for working with e-mail.
- build_email_address(email, full_name=None)¶
Build an e-mail address for a To/CC/BCC field from a user’s information.
Build an e-mail address for a To/CC/BCC field from a User.
- build_email_address_via_service(email, full_name=None, service_name=None, sender_email=None)¶
Build an e-mail address for sending on behalf of a user via a service.
This will construct a formatted e-mail address that can be safely used in a From field without risking being quarantined/rejected by DMARC rules.
The address will be in the form of “Full Name via Service Name <firstname.lastname@example.org>”.
unicode) – The unformatted e-mail address of the user.
unicode, optional) – The full name of the user. If not provided, the username in the e-mail address will be used.
unicode, optional) – The name of the service sending the e-mail. If not provided,
settings.EMAIL_DEFAULT_SENDER_SERVICE_NAMEwill be used.
A formatted e-mail address safe to use in a From field.
- Return type: