Skip to content

parsedmarc.mail 🔗

GmailConnection 🔗

GmailConnection(
    token_file: str,
    credentials_file: str,
    scopes: list[str],
    include_spam_trash: bool,
    reports_folder: str,
    oauth2_port: int,
)

Bases: MailboxConnection

MailboxConnection for Google accounts using the Google API.

This will support both Gmail and Google Workspace accounts.

PARAMETER DESCRIPTION
token_file

TYPE: str

credentials_file

TYPE: str

scopes

TYPE: list[str]

include_spam_trash

TYPE: bool

reports_folder

TYPE: str

oauth2_port

TYPE: int

watch 🔗

watch(check_callback, check_timeout) -> None

Checks the mailbox for new messages every n seconds

IMAPConnection 🔗

IMAPConnection(
    host: str | None = None,
    user: str | None = None,
    password: str | None = None,
    port: int | None = None,
    ssl: bool = True,
    verify: bool = True,
    timeout: int = 30,
    max_retries: int = 4,
)

Bases: MailboxConnection

MailboxConnection for connecting to a mailbox via IMAP.

PARAMETER DESCRIPTION
host

Host to connect to

TYPE: str | None DEFAULT: None

user

TYPE: str | None DEFAULT: None

password

TYPE: str | None DEFAULT: None

port

Port to connect to

TYPE: int | None DEFAULT: None

ssl

Use SSL/TLS

TYPE: bool DEFAULT: True

verify

Verify the SSL/TLS certification

TYPE: bool DEFAULT: True

timeout

TYPE: int DEFAULT: 30

max_retries

TYPE: int DEFAULT: 4

watch 🔗

watch(check_callback, check_timeout)

Use an IDLE IMAP connection to parse incoming emails, and pass the results to a callback function

MSGraphConnection 🔗

MSGraphConnection(
    auth_method: str,
    client_id: str,
    client_secret: str,
    token_file: str,
    allow_unencrypted_storage: bool,
    username: str | None = None,
    password: str | None = None,
    tenant_id: str | None = None,
    mailbox: str | None = None,
)

Bases: MailboxConnection

MailboxConnection to a Microsoft account via the Micorsoft Graph API

PARAMETER DESCRIPTION
auth_method

TYPE: str

mailbox

TYPE: str | None DEFAULT: None

client_id

TYPE: str

client_secret

TYPE: str

username

TYPE: str | None DEFAULT: None

password

TYPE: str | None DEFAULT: None

tenant_id

TYPE: str | None DEFAULT: None

token_file

TYPE: str

allow_unencrypted_storage

TYPE: bool

fetch_messages 🔗

fetch_messages(reports_folder: str, **kwargs) -> list[str]

Returns a list of message UIDs in the specified folder

mark_message_read 🔗

mark_message_read(message_id: str)

Marks a message as read

watch 🔗

watch(check_callback, check_timeout)

Checks the mailbox for new messages every n seconds

MailboxConnection 🔗

Bases: ABC

Interface for a mailbox connection