asphalt.mailer.mailers.smtp
- class asphalt.mailer.mailers.smtp.SMTPMailer(*, host='localhost', port=None, tls=None, tls_context=None, username=None, password=None, timeout=10, message_defaults=None)
Bases:
Mailer
A mailer that uses aiosmtplib to send mails.
The default port is chosen as follows:
587: if
username
andpassword
have been defined andtls
isTrue
25: in all other cases
- Parameters
host (str) – host name of the SMTP server
port (int | None) – override the default port (see above)
tls (bool | None) – whether to initiate TLS using STARTTLS once connected (defaults to
True
ifusername
andpassword
have been defined)tls_context (str | SSLContext | None) – either an
SSLContext
instance or the resource name of oneusername (str | None) – username to authenticate as
password (str | None) – password to authenticate with
timeout (float) – timeout (in seconds) for all network operations
message_defaults (dict[str, Any] | None) – default values for omitted keyword arguments of
create_message()
- coroutine deliver(self, messages)
Deliver the given message(s).
- Parameters
messages (EmailMessage | Iterable[EmailMessage]) – the message or iterable of messages to deliver
- Return type
None