Skip to main content

Simple inbox event listener for exchangelib.

Project description

Inbox event listener for exchangelib

This library listens for events in the inbox and raises an event.

Usage

Create listener:

from exchangelib import DELEGATE, Account, Credentials, Configuration
from exchangelib.properties import NewMailEvent, MovedEvent
from exchangelib_listener import Listener

creds = Credentials(
    username='EMAIL_ADDRESS',
    password='PASSWORD'
)
config = Configuration(
    server='SERVER',
    credentials=creds
)
acct = Account(
    primary_smtp_address='EMAIL_ADDRESS',
    config=config,
    access_type=DELEGATE
)

listener = Listener(acct)

Create a method to call when events are raised:

def events_received(events):
    for event in events:
        if isinstance(event, NewMailEvent):
            # Do something
        elif isinstance(event, MovedEvent):
            # Do something

listener.streaming_events_received += events_received
listener.listen()

Or receive a single event:

def new_messaged_received():
    # Do something

listener.streaming_event_received += new_messaged_received
listener.listen(NewMailEvent)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exchangelib_listener-1.1.1.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file exchangelib_listener-1.1.1.tar.gz.

File metadata

  • Download URL: exchangelib_listener-1.1.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.6

File hashes

Hashes for exchangelib_listener-1.1.1.tar.gz
Algorithm Hash digest
SHA256 31044b246b7a7e27981bd1b109171825beec3d8c21d4f39048ab139ef3928128
MD5 c3f89745060f1603effeaf620a0442e3
BLAKE2b-256 46b28d16613cf55a5441aa1d7a294fbf632ccfae45044acdaad1b0c9e7048807

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page