core.mail_processor.smtp

Send E-Mail through SMTP

Adapted from repoze.sendmail: https://github.com/repoze/repoze.sendmail

Usage:

mailer = smptlib.SMTP(host, port) qp = SMTPEmailQueueProcessor(mailer, maildir1, maildir2, …, limit=x) qp.send_messages()

Attributes

log

Classes

MailQueueProcessor

SMTPMailQueueProcessor

Module Contents

core.mail_processor.smtp.log[source]
class core.mail_processor.smtp.MailQueueProcessor(*paths: str, limit: int | None = None)[source]
split(filename: str) tuple[str, str, str][source]

Returns the path, the name and the suffix of the given path.

message_files() tuple[str, Ellipsis][source]

Returns a tuple of full paths that need processing.

The file names in the directory usually look like this:

  • 0.1571822840.745629

  • 1.1571822743.595377

The part before the first dot is the batch number the rest is the timestamp at time of calling app.send_sms.

The messages are sorted by suffix, so by default the sorting happens from oldest to newest message.

abstract send(filename: str, payload: str) bool[source]

Sends the mail and returns success as bool

parse(filename: str) str[source]
send_messages() None[source]
send_message(filename: str) bool[source]
class core.mail_processor.smtp.SMTPMailQueueProcessor(mailer: smtplib.SMTP, *paths: str, limit: int | None = None)[source]

Bases: core.mail_processor.core.MailQueueProcessor

parse_payload(filename: str, payload: str) list[email.message.EmailMessage][source]
send(filename: str, payload: str) bool[source]

Sends the mail and returns success as bool