orbitra.commons.email.client
Functions
get_email_client
environment: Environment to use (“prod” or “dev”). Defaults to “prod”.credential: Synchronous Azure credential for API operations.email_address: Optional email address to use for app-only auth URL resolution.
- An instance of the OrbitraEmailClient class.
Classes
OrbitraEmailClient
OrbitraEmailClient for interacting with email functionality using Microsoft Graph API.
Methods:
get_email
email_id: The ID of the email to retrieve.include_attachments: Whether to include attachment details in the response. Defaults to True.
- An object containing detailed information about the email.
See :class:
orbitra.commons.email.models.EmailDetail.
Exception: If retrieving the email fails or attachments fails.
list_emails
folder: The email folder to list emails from (e.g., “inbox”, “sentitems”, “junkemail”). Defaults to “inbox”.top: The maximum number of emails to return. Defaults to 25.state: Filter emails by their state. Defaults to None.is_read: Filter emails by read/unread status. Defaults to None.received_after: Filter emails received after this date/time (ISO 8601 format). Defaults to None.received_before: Filter emails received before this date/time (ISO 8601 format). Defaults to None.subject_contains: Filter emails where the subject contains this string. Defaults to None.from_contains: Filter emails where the sender’s email address contains this string. Defaults to None.
- list[EmailDetail]: A list of email details matching the specified criteria.
See :class:
orbitra.commons.email.models.EmailDetail.
Exception: If listing emails fails.
send_email
subject: The subject of the email.body: The body of the email.to: The list of recipients.cc: The list of CC recipients. Defaults to None.bcc: The list of BCC recipients. Defaults to None.attachments: The list of attachments. Each attachment is a dict with ‘filename’ and ‘content’ keys. Defaults to None.body_format: The format of the email body. Defaults to “html”.reply_to: The list of reply-to addresses. Defaults to None.
Exception: If email sending fails.
set_email_processing_state
email_id: The ID of the email to update.state: The state to set for the email.
Exception: If updating the email state fails.