fftools.mailer

fftools.mailer.send_mail(receivers: str | list[str], subject: str, message: Any, smtp_sender: str, smtp_password: str, smtp_server: str, smtp_port: int = 465, smtp_tls: bool = True, attachments: list[str | Path] | None = None) None[source]

send smtp mail.

Parameters:
  • receivers (str | list[str]) – receivers which the mail should be sent to. either a mail address, or a list of mail addresses.

  • subject (str) – subject of the mail.

  • message (Any) – mail body.

  • smtp_sender (str) – sender mail address.

  • smtp_password (str) – password of the mail sender.

  • smtp_server (str) – smtp server to connect to.

  • smtp_port (int) – smtp port to connect to. Defaults to 465.

  • smtp_tls (bool) – if TLS/SSL should be used. False means StartTLS will be used. Defaults to True.

  • attachments (list[str | Path] | None) – any file attachments to add. Defaults to None.

Raises:

exc – if mail could not be sent.

Return type:

None