gws.helper.email

Email sending helper.

Source code: gws.helper.email

Package Contents

class gws.helper.email.Config(*args, **kwargs)

Bases: gws.Config

Mail helper settings

mailFrom: str = ''

Default ‘From’ address.

smtp: SmtpConfig

SMTP server configuration.

exception gws.helper.email.Error

Bases: gws.Error

GWS error.

class gws.helper.email.Message(*args, **kwargs)

Bases: gws.Data

Email message.

bcc: str

Bcc addresses.

html: str

HTML content.

mailFrom: str

From address (default if omitted).

mailTo: str

To addresses, comma separated.

subject: str

Subject.

text: str

Plain text content.

class gws.helper.email.Object

Bases: gws.Node

Configurable GWS object.

mailFrom: str
smtp: _SmtpServer
configure()

Configuration hook.

send_mail(m: Message)
class gws.helper.email.SmtpConfig(*args, **kwargs)

Bases: gws.Config

SMTP server configuration. (added in 8.1)

host: str

SMTP host name

login: str = ''

Login

mode: SmtpMode = 'ssl'

Connection mode.

password: str = ''

Password.

port: int = 0

SMTP port.

timeout: gws.Duration = 30

Connection timeout.

class gws.helper.email.SmtpMode

Bases: gws.Enum

Enumeration type.

Despite being declared as extending Enum (for IDE support), this class is actually just a simple object and intended to be used as a collection of attributes. It doesn’t provide any Enum-specific utilities.

The rationale behind this is that we need Enum members (e.g. Color.RED) to be scalars, and not complex objects as in the standard Enum.

plain = 'plain'
ssl = 'ssl'
tls = 'tls'