Skip to content

Latest commit

 

History

History
228 lines (154 loc) · 13.8 KB

sendemail.md

File metadata and controls

228 lines (154 loc) · 13.8 KB

SendEmail.py File Notes

Author - Gino Vincenzini

Summary

Imports

This module imports several standard as well as external libraries:

Standard Library

abc: ABCMeta, abstractmethod

re: sub

os: mkdir

os.path: expanduser, isdir, join

configparser: ConfigParser

email.mime.multipart: MIMEMultipart

email.mime.text: MIMEText

smtplib: SMTP, SMTPConnectError, SMTPException

typing: Optional

EmailHandler class

This class acts as a protocol for email handlers. As long as these five methods are implemented, The main method can be changed to support more output sources (stdout, Microsoft Exchange, etc). It defines the five methods below which any handler must implement to be dropped in to email the rendered template. The methods are documented below.

The protocol/interface spec is enforced using the ABCMeta class and the @abstractmethod decorator.

EmailHandler.__init__(self, configFilePath: str) -> None

EmailHandler.__del__(self) -> None

EmailHandler.SendEmail(self, destination: str, content: str, text_content: str) -> list[str]

EmailHandler.Connect(self) -> None

EmailHandler.TestConnection(self) -> tuple[bool, str]

SMTPHandler class

SMTPHandler Properties

SMTPHandler.__init__(self, configFilePath: str) -> None

SMTPHandler.__del__(self) -> None

SMTPHandler.SendEmail(self, destination: str, content: str, text_content: str) -> list[str]

SMTPHandler.Connect(self) -> None

SMTPHandler.TestConnection(self) -> tuple[bool, str]

TXTHandler class

TXTHandler Properties

TXTHandler.__init__(self, configFilePath: str = "") -> None

TXTHandler.__del__(self) -> None

TXTHandler.Connect(self) -> None

TXTHandler.TestConnection(self) -> bool

TXTHandler.SendEmail(self, destination: str, content: str, text_content: str) -> list[str]

Email class

Email Properties

Email.__init__(self, recipient: str, content: str, text_content: str, handler=None) -> None

Email.__str__(self) -> str

Email.SendEmail(self) -> None