s365b.notify.senders ==================== .. py:module:: s365b.notify.senders .. autoapi-nested-parse:: Ways to send email: Microsoft Graph and SMTP. Exceptions ---------- .. autoapisummary:: s365b.notify.senders.SendError Classes ------- .. autoapisummary:: s365b.notify.senders.Notifier s365b.notify.senders.GraphNotifier s365b.notify.senders.SmtpNotifier Module Contents --------------- .. py:exception:: SendError Bases: :py:obj:`Exception` Sending failed. The message is safe to show. .. py:class:: Notifier Bases: :py:obj:`Protocol` Something that can send an email. .. py:attribute:: name :type: str .. py:method:: send(message: s365b.notify.message.Message, recipients: list[str]) -> None :async: Send one message. :param message: The message. :param recipients: To addresses. :raises SendError: If sending failed. .. py:class:: GraphNotifier(graph: s365b.graph.client.GraphClient, sender: str) Sends as a mailbox through ``/users/{sender}/sendMail``. The Notifications app may send only as that mailbox: its ``Mail.Send`` is an Exchange RBAC assignment scoped to it, not a tenant-wide grant. :param graph: Graph client authenticated as the Notifications app. :param sender: Sender mailbox address. .. py:attribute:: name :value: 'graph' .. py:attribute:: graph .. py:attribute:: sender .. py:method:: send(message: s365b.notify.message.Message, recipients: list[str]) -> None :async: Send one message (not saved to Sent Items). :param message: The message. :param recipients: To addresses. :raises SendError: If Graph refuses or cannot be reached. .. py:class:: SmtpNotifier(host: str, port: int, security: str, sender: str, username: str = '', password: str = '', timeout: float = 30.0) Sends through an SMTP relay. :param host: Relay host. :param port: Port. :param security: ``starttls``, ``tls`` (implicit) or ``none``. :param sender: From address. :param username: Login user; empty for none. :param password: Login password. :param timeout: Socket timeout in seconds. .. py:attribute:: name :value: 'smtp' .. py:attribute:: timeout :value: 30.0 .. py:method:: send(message: s365b.notify.message.Message, recipients: list[str]) -> None :async: Send one message. :param message: The message. :param recipients: To addresses. :raises SendError: For connection, TLS, authentication or relay errors.