mail

class platypush.backend.mail.MailBackend(mailboxes: List[Dict[str, Any]], timeout: Optional[int] = 60, poll_seconds: Optional[int] = 60, **kwargs)[source]

This backend can subscribe to one or multiple mail servers and trigger events when new messages are received or messages are marked as seen.

It requires at least one plugin that extends platypush.plugins.mail.MailInPlugin (e.g. mail.imap) to be installed.

Triggers:

__init__(mailboxes: List[Dict[str, Any]], timeout: Optional[int] = 60, poll_seconds: Optional[int] = 60, **kwargs)[source]
Parameters
  • mailboxes

    List of mailboxes to be monitored. Each mailbox entry contains a plugin attribute to identify the platypush.plugins.mail.MailInPlugin plugin that will be used (e.g. mail.imap) and the arguments that will be passed to platypush.plugins.mail.MailInPlugin.search_unseen_messages(). The name parameter can be used to identify this mailbox in the relevant events, otherwise Mailbox #{id} will be used as a name. Example configuration:

    backend.mail:
        mailboxes:
            - plugin: mail.imap
              name: "My Local Server"
              username: me@mydomain.com
              password: my-imap-password
              server: localhost
              ssl: true
              folder: "All Mail"
    
            - plugin: mail.imap
              name: "GMail"
              username: me@gmail.com
              password: my-google-password
              server: imap.gmail.com
              ssl: true
               folder: "INBOX"
    

    If you have a default configuration available for a mail plugin you can implicitly reuse it without replicating it here. Example:

    mail.imap:
        username: me@mydomain.com
        password: my-imap-password
        server: localhost
        ssl: true
    
    backend.mail:
        mailboxes:
            # The mail.imap default configuration will be used
            - plugin: mail.imap
              name: "My Local Server"
              folder: "All Mail"
    

  • poll_seconds – How often the backend should check the mail (default: 60).

  • timeout – Connect/read timeout for a mailbox, in seconds (default: 60).

class platypush.backend.mail.Mailbox(plugin: platypush.plugins.mail.MailInPlugin, name: str, args: dict)[source]
__init__(plugin: platypush.plugins.mail.MailInPlugin, name: str, args: dict) None
class platypush.backend.mail.MailboxStatus(**kwargs)[source]

Models the MailboxStatus table, containing information about the state of a monitored mailbox.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.