Module reahl.mailutil.mail

Utility classes for sending simple email messages.

MailMessage

class reahl.mailutil.mail.MailMessage(from_address, to_addresses, subject, rst_message, charset=u'utf-8')

Represents an email message, with one part containing plain text (presumed to be ReST), and the other an HTML representation of the same message.

Parameters:
  • from_address – The “from” email address
  • to_addresses – A list of “to” email addresses
  • subject – The subject line
  • rst_message – A message, expressed as a string containing ReStructured Text
  • charset – The charset of rst_message
as_string()

Returns the message as ASCII-encoded string for sending.

Mailer

class reahl.mailutil.mail.Mailer(smtp_host=u'localhost', smtp_port=8025, smtp_user=None, smtp_password=None)

A proxy for a remote SMTP server.

Parameters:
  • smtp_host – The host to connect to.
  • smtp_port – The port to connect to.
  • smtp_user – The username to use (if specified) for authentication.
  • smtp_password – The password to authenticate with the smtp host
classmethod from_context()

Returns a Mailer, using the host and port of the system configuration.

send_message(message)

Sends message (a MailMessage) to the connected SMTP server.

Table Of Contents

Previous topic

Module reahl.domainui.workflow

Next topic

Module reahl.mailutil.rst