Skip to main content

Enterprise Email Connector for Assets

Project description

Enterprise Email Connector for Assets

An enterprise-grade Python library for securely connecting to and processing email assets. It supports IMAP connections over SSL, and modern authentication methods like OAuth2 (XOAUTH2) using MSAL.

Features

  • Secure Connection: Connect securely to IMAP servers (e.g., Office365, Gmail) over SSL.
  • Modern Authentication: Support for traditional username/password or Azure OAuth2 (Client ID, Secret, and Tenant ID).
  • Email Fetching: Fetch emails based on IMAP search criteria.
  • Robust Parsing: Safely parses raw emails and extracts subjects and plain text bodies.

Installation

You can install the connector from PyPI:

pip install assets-email-connector

Usage

Basic Usage with Password Authentication

from assets_email_connector import EnterpriseEmailConnector

connector = EnterpriseEmailConnector(
    host="imap.example.com",
    username="user@example.com",
    password="securepassword"
)

if connector.connect():
    emails = connector.fetch_emails(mailbox="inbox", search_criteria="ALL")
    print(f"Fetched {emails['total_emails']} emails.")
    for email in emails["emails"]:
        print(f"Subject: {email['subject']}")
    
    connector.disconnect()

Advanced Usage with OAuth2 (Azure Active Directory)

from assets_email_connector import EnterpriseEmailConnector

connector = EnterpriseEmailConnector(
    host="outlook.office365.com",
    username="user@example.com",
    tenant_id="your-tenant-id",
    client_id="your-client-id",
    client_secret="your-client-secret"
)

if connector.connect():
    emails = connector.fetch_emails()
    print(f"Fetched {emails['total_emails']} emails.")
    connector.disconnect()

Requirements

  • Python 3.8+
  • msal >= 1.20.0

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

assets_email_connector-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

assets_email_connector-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file assets_email_connector-0.1.0.tar.gz.

File metadata

  • Download URL: assets_email_connector-0.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for assets_email_connector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2b31f6b5efba9fb581a68d7a5be965c46dafb767ee77c7b3532cdcd10315aeeb
MD5 9b2bc381c53745dc824d85b230689e4d
BLAKE2b-256 cb46d1b59214610b9bec4353acd45d6b2e8927948e63201b12370ac51aa89db2

See more details on using hashes here.

File details

Details for the file assets_email_connector-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for assets_email_connector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2dea7ef3e091a9a5a0ca982f645b01ca3619de1f978e66b760c3e4b5c9d3bf17
MD5 89a65c9bc2c8eccf37b842b30c4a1ffd
BLAKE2b-256 4fe5d4d2abcb62a6155da9b7c7a237b61f43dad73e1a08b1f8d82737e9b109c2

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