Mail Module Reference

New in version 0.0.4.

Control the macOS Mail application using JXA-like syntax.

Classes:

XAMailAccount(properties)

A class for managing and interacting with accounts in Mail.app.

XAMailAccountList(properties[, filter, ...])

A wrapper around lists of mail accounts that employs fast enumeration techniques.

XAMailApplication(properties)

A class for managing and interacting with Mail.app.

XAMailAttachment(properties)

A class for managing and interacting with message attachments in Mail.app.

XAMailAttachmentList(properties[, filter])

A wrapper around lists of attachments that employs fast enumeration techniques.

XAMailBccRecipient(properties)

A class for managing and interacting with BCC recipients in Mail.app.

XAMailBccRecipientList(properties[, filter])

A wrapper around lists of mail Bcc recipients that employs fast enumeration techniques.

XAMailCcRecipient(properties)

A class for managing and interacting with CC recipients in Mail.app.

XAMailCcRecipientList(properties[, filter])

A wrapper around lists of mail Cc recipients that employs fast enumeration techniques.

XAMailContainer(properties)

A class for managing and interacting with containers in Mail.app.

XAMailContainerList(properties[, filter])

A wrapper around lists of mail headers that employs fast enumeration techniques.

XAMailDocument(properties)

A class for managing and interacting with Mail documents.

XAMailDocumentList(properties[, filter])

A wrapper around lists of mail documents that employs fast enumeration techniques.

XAMailHeader(properties)

A class for managing and interacting with message headers in Mail.app.

XAMailHeaderList(properties[, filter])

A wrapper around lists of mail headers that employs fast enumeration techniques.

XAMailICloudAccount(properties)

A class for managing and interacting with iCloud accounts in Mail.app.

XAMailICloudAccountList(properties[, filter])

A wrapper around lists of iCloud accounts that employs fast enumeration techniques.

XAMailIMAPAccount(properties)

A class for managing and interacting with IMAP accounts in Mail.app.

XAMailIMAPAccountList(properties[, filter])

A wrapper around lists of mail documents that employs fast enumeration techniques.

XAMailMessage(properties)

A class for managing and interacting with messages in Mail.app.

XAMailMessageList(properties[, filter])

A wrapper around lists of messages that employs fast enumeration techniques.

XAMailMessageViewer(properties)

A class for managing and interacting with the message viewer window in Mail.app.

XAMailMessageViewerList(properties[, filter])

A wrapper around lists of mail signatures that employs fast enumeration techniques.

XAMailOutgoingMessage(properties)

A class for managing and interacting with outgoing messages in Mail.app.

XAMailOutgoingMessageList(properties[, filter])

A wrapper around lists of outgoing messages that employs fast enumeration techniques.

XAMailPOPAccount(properties)

A class for managing and interacting with POP accounts in Mail.app.

XAMailPOPAccountList(properties[, filter])

A wrapper around lists of mail documents that employs fast enumeration techniques.

XAMailRecipient(properties)

A class for managing and interacting with recipients in Mail.app.

XAMailRecipientList(properties[, filter, ...])

A wrapper around lists of mail recipients that employs fast enumeration techniques.

XAMailRule(properties)

A class for managing and interacting with rules in Mail.app.

XAMailRuleCondition(properties)

A class for managing and interacting with rule conditions in Mail.app.

XAMailRuleConditionList(properties[, filter])

A wrapper around lists of rule conditions that employs fast enumeration techniques.

XAMailRuleList(properties[, filter])

A wrapper around lists of rules that employs fast enumeration techniques.

XAMailSMTPServer(properties)

A class for managing and interacting with SMTP servers in Mail.app.

XAMailSMTPServerList(properties[, filter])

A wrapper around lists of SMTP servers that employs fast enumeration techniques.

XAMailSignature(properties)

A class for managing and interacting with email signatures in Mail.app.

XAMailSignatureList(properties[, filter])

A wrapper around lists of mail signatures that employs fast enumeration techniques.

XAMailToRecipient(properties)

A class for managing and interacting with the primary (to) recipients in Mail.app.

XAMailToRecipientList(properties[, filter])

A wrapper around lists of mail primary (to) recipients that employs fast enumeration techniques.

XAMailWindow(properties)

A class for managing and interacting with Mail documents.

XAMailbox(properties)

A class for managing and interacting with mailboxes in Mail.app.

XAMailboxList(properties[, filter, obj_class])

A wrapper around lists of mailboxes that employs fast enumeration techniques.

class PyXA.apps.Mail.XAMailAccount(properties)[source]

Bases: XAObject

A class for managing and interacting with accounts in Mail.app.

New in version 0.0.4.

Attributes:

account_directory

The directory where the account stores items on the disk.

account_type

The type of the account, either: "pop", "smtp", "imap", or "iCloud".

authentication

he preferred authentication scheme for the account, either: "password", "apop", "kerberos 5", "ntlm", "md5", "external", "Apple token", or "none".

delivery_account

The delivery account use when sending messages from the account.

email_addresses

The list of email addresses associated with the account.

empty_junk_messages_frequency

Number of days before junk messages are deleted (0 = delete on quit, -1 = never delete).

empty_junk_messages_on_quit

Whether messages marked as junk are deleted upon quitting Mail.app.

empty_trash_frequency

Number of days before messages in the trash are deleted (0 = delete on quit, -1 = never delete).

empty_trash_on_quit

Whether messages in the trash are permanently deleted upon quitting Mail.app.

enabled

Whether the account is enabled.

full_name

The user's full name associated with the account.

id

The unique identifier for the account.

move_deleted_messages_to_trash

Whether messages are moved to the trash mailbox upon deletion.

name

The name of the account.

password

The password for the account.

port

The port used to connect to the account.

server_name

The host name used to connect to the account.

user_name

The user name used to connect to the account.

uses_ssl

Whether SSL is enabled for this receiving account.

Methods:

mailboxes([filter])

Returns a list of mail accounts matching the filter.

property account_directory: str

The directory where the account stores items on the disk.

property account_type: AccountType

The type of the account, either: “pop”, “smtp”, “imap”, or “iCloud”.

property authentication: AuthenticationMethod

he preferred authentication scheme for the account, either: “password”, “apop”, “kerberos 5”, “ntlm”, “md5”, “external”, “Apple token”, or “none”.

property delivery_account: XAMailSMTPServer

The delivery account use when sending messages from the account.

property email_addresses: list[str]

The list of email addresses associated with the account.

property empty_junk_messages_frequency: int

Number of days before junk messages are deleted (0 = delete on quit, -1 = never delete).

property empty_junk_messages_on_quit: bool

Whether messages marked as junk are deleted upon quitting Mail.app.

property empty_trash_frequency: int

Number of days before messages in the trash are deleted (0 = delete on quit, -1 = never delete).

property empty_trash_on_quit: bool

Whether messages in the trash are permanently deleted upon quitting Mail.app.

property enabled: bool

Whether the account is enabled.

property full_name: str

The user’s full name associated with the account.

property id: str

The unique identifier for the account.

mailboxes(filter: dict | None = None) XAMailboxList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

property move_deleted_messages_to_trash: bool

Whether messages are moved to the trash mailbox upon deletion.

property name: str

The name of the account.

property password: None

The password for the account.

property port: int

The port used to connect to the account.

property server_name: str

The host name used to connect to the account.

property user_name: str

The user name used to connect to the account.

property uses_ssl: bool

Whether SSL is enabled for this receiving account.

class PyXA.apps.Mail.XAMailAccountList(properties: dict, filter: dict | None = None, object_class=None)[source]

Bases: XAList

A wrapper around lists of mail accounts that employs fast enumeration techniques.

All properties of accounts can be called as methods on the wrapped list, returning a list containing each account’s value for the property.

New in version 0.0.4.

Methods:

account_directory()

account_type()

authentication()

by_account_directory(account_directory)

by_account_type(account_type)

by_authentication(authentication)

by_delivery_account(delivery_account)

by_email_addresses(email_addresses)

by_empty_junk_messages_frequency(...)

by_empty_junk_messages_on_quit(...)

by_empty_trash_frequency(empty_trash_frequency)

by_empty_trash_on_quit(empty_trash_on_quit)

by_enabled(enabled)

by_full_name(full_name)

by_id(id)

by_move_deleted_messages_to_trash(...)

by_name(name)

by_port(port)

by_server_name(server_name)

by_user_name(user_name)

by_uses_ssl(uses_ssl)

delivery_account()

email_addresses()

empty_junk_messages_frequency()

empty_junk_messages_on_quit()

empty_trash_frequency()

empty_trash_on_quit()

enabled()

full_name()

id()

mailboxes()

move_deleted_messages_to_trash()

name()

port()

server_name()

user_name()

uses_ssl()

account_directory() list[str][source]
account_type() list[AccountType][source]
authentication() list[AuthenticationMethod][source]
by_account_directory(account_directory: str) XAMailAccount | None[source]
by_account_type(account_type: AccountType) XAMailAccount | None[source]
by_authentication(authentication: AuthenticationMethod) XAMailAccount | None[source]
by_delivery_account(delivery_account: XAMailSMTPServer) XAMailAccount | None[source]
by_email_addresses(email_addresses: list[str]) XAMailAccount | None[source]
by_empty_junk_messages_frequency(empty_junk_messages_frequency: int) XAMailAccount | None[source]
by_empty_junk_messages_on_quit(empty_junk_messages_on_quit: bool) XAMailAccount | None[source]
by_empty_trash_frequency(empty_trash_frequency: int) XAMailAccount | None[source]
by_empty_trash_on_quit(empty_trash_on_quit: bool) XAMailAccount | None[source]
by_enabled(enabled: bool) XAMailAccount | None[source]
by_full_name(full_name: str) XAMailAccount | None[source]
by_id(id: str) XAMailAccount | None[source]
by_move_deleted_messages_to_trash(move_deleted_messages_to_trash: bool) XAMailAccount | None[source]
by_name(name: str) XAMailAccount | None[source]
by_port(port: int) XAMailAccount | None[source]
by_server_name(server_name: str) XAMailAccount | None[source]
by_user_name(user_name: str) XAMailAccount | None[source]
by_uses_ssl(uses_ssl: bool) XAMailAccount | None[source]
delivery_account() XAMailSMTPServerList[source]
email_addresses() list[list[str]][source]
empty_junk_messages_frequency() list[int][source]
empty_junk_messages_on_quit() list[bool][source]
empty_trash_frequency() list[int][source]
empty_trash_on_quit() list[bool][source]
enabled() list[bool][source]
full_name() list[str][source]
id() list[str][source]
mailboxes()[source]
move_deleted_messages_to_trash() list[bool][source]
name() list[str][source]
port() list[int][source]
server_name() list[str][source]
user_name() list[str][source]
uses_ssl() list[bool][source]
class PyXA.apps.Mail.XAMailApplication(properties)[source]

Bases: XASBApplication

A class for managing and interacting with Mail.app.

New in version 0.0.4.

Classes:

AccountType(value)

Options for Mail account types.

AuthenticationMethod(value)

Options for Mail account authentication methods.

CachingPolicy(value)

An enumeration.

Format(value)

Options for file and message formats.

HighlightColor(value)

Options for colors to use when highlighting text.

QuotingColor(value)

Options for colors to use when quoting text.

RuleQualifier(value)

Options for how Mail rules are qualified.

RuleType(value)

Types of rules in Mail.app.

ViewerColumn(value)

Columns in message viewer windows.

Methods:

accounts([filter])

Returns a list of mail accounts matching the filter.

check_for_new_mail(account)

imap_accounts([filter])

Returns a list of mail accounts matching the filter.

import_mailbox(file_path)

mailboxes([filter])

Returns a list of mail accounts matching the filter.

message_viewers([filter])

Returns a list of mail accounts matching the filter.

outgoing_messages([filter])

Returns a list of mail accounts matching the filter.

pop_accounts([filter])

Returns a list of mail accounts matching the filter.

rules([filter])

Returns a list of mail accounts matching the filter.

signatures([filter])

Returns a list of mail accounts matching the filter.

smtp_servers([filter])

Returns a list of mail accounts matching the filter.

synchronize(account)

Attributes:

always_bcc_myself

Whether the user's email address will be included in the Bcc: field of composed messages.

always_cc_myself

Whether the user's email address will be included in the Cc: field of composed messages.

application_version

The build number of Mail.app.

background_activity_count

The number of background activities currently running in Mail.

check_spelling_while_typing

Whether spelling is checked automatically while composing messages.

choose_signature_when_composing

Whether the user can choose a signature directly in a new compose window.

color_quoted_text

Whether quoted text should be colored.

default_message_format

The default format for messages being composed.

download_html_attachments

Whether images and attachments in HTML messages should be downloaded and displayed.

drafts_mailbox

The top-level drafts mailbox.

expand_group_addresses

Whether group addresses should be expanded when entered into the address fields of a new message.

fetch_interval

The number of minutes between automatic fetches for new mail (-1 = use automatically determined interval).

fetches_automatically

Whether mail will automatically be fetched at a specific interval.

fixed_width_font

The name of the font used for plain text messages.

fixed_width_font_size

The font size for plain text messages.

frontmost

Whether Mail is the active application.

highlight_selected_conversation

Whether messages in conversations should be highlighted in the Mail viewer window when not grouped.

inbox

The top-level inbox.

include_all_original_message_text

Whether all text of the original message will be quoted or only text the user selects.

junk_mailbox

The top-level junk mailbox.

level_one_quoting_color

Color for quoted text with one level of indentation.

level_three_quoting_color

Color for quoted text with three levels of indentation.

level_two_quoting_color

Color for quoted text with two levels of indentation.

message_font

The name of the font for messages.

message_font_size

The font size for messages.

message_list_font

The name of the font for the message list.

message_list_font_size

The font size for the message list.

name

The name of the application.

new_mail_sound

The name of the sound that plays when new mail is received, or "None".

outbox

The top-level outbox.

primary_email

The user's primary email address.

quote_original_message

Whether the text of the original message should be included in replies.

same_reply_format

Whether replies will be in the same text format as the message to which the user is replying.

selected_signature

The name of the currently selected signature (or "randomly", "sequentially", or "none").

selection

The list of messages currently selected by the user.

sent_mailbox

The top-level sent mailbox.

should_play_other_mail_sounds

Whether sounds will be played for actions and events other than receiving email.

trash_mailbox

The top-level trash mailbox.

use_fixed_width_font

Whether a fixed-width font should be used for plain text messages.

version

The version number of Mail.app.

class AccountType(value)[source]

Bases: Enum

Options for Mail account types.

Attributes:

ICLOUD

IMAP

POP

SMTP

UNKNOWN

ICLOUD = 1702127988
IMAP = 1702127981
POP = 1702129775
SMTP = 1702130541
UNKNOWN = 1702131054
class AuthenticationMethod(value)[source]

Bases: Enum

Options for Mail account authentication methods.

Attributes:

APOP

APOP

APPLE_TOKEN

Apple token

EXTERNAL

External authentication (TLS client certificate)

KERBEROS5

Kerberos V5 (GSSAPI)

MD5

CRAM-MD5

NONE

None

NTLM

NTLM

PASSWORD

Clear text password

APOP = 1633775727

APOP

APPLE_TOKEN = 1635020651

Apple token

EXTERNAL = 1634039924

External authentication (TLS client certificate)

KERBEROS5 = 1635281717

Kerberos V5 (GSSAPI)

MD5 = 1635282276

CRAM-MD5

NONE = 1667460719

None

NTLM = 1635282548

NTLM

PASSWORD = 1635279732

Clear text password

class CachingPolicy(value)[source]

Bases: Enum

An enumeration.

Attributes:

ALL_MESSAGES_AND_THEIR_ATTACHMENTS

All messages and their attachments

ALL_MESSAGES_BUT_OMIT_ATTACHMENTS

All messages but omit attachments

DO_NOT_KEEP_COPIES_OF_ANY_MESSAGES

Do not use this option (deprecated).

ONLY_MESSAGES_I_HAVE_READ

Do not use this option (deprecated).

ALL_MESSAGES_AND_THEIR_ATTACHMENTS = 2017026412

All messages and their attachments

ALL_MESSAGES_BUT_OMIT_ATTACHMENTS = 2017026671

All messages but omit attachments

DO_NOT_KEEP_COPIES_OF_ANY_MESSAGES = 2017029743

Do not use this option (deprecated). If you do, Mail will use the ‘all messages but omit attachments’ policy

ONLY_MESSAGES_I_HAVE_READ = 2017032050

Do not use this option (deprecated). If you do, Mail will use the ‘all messages but omit attachments’ policy

class Format(value)[source]

Bases: Enum

Options for file and message formats.

Attributes:

NATIVE

PLAIN_MESSAGE

RICH_MESSAGE

NATIVE = 1769235821
PLAIN_MESSAGE = 1684893812
RICH_MESSAGE = 1684894324
class HighlightColor(value)[source]

Bases: Enum

Options for colors to use when highlighting text.

Attributes:

BLUE

GRAY

GREEN

NONE

ORANGE

OTHER

PURPLE

RED

YELLOW

BLUE = 1667457644
GRAY = 1667458937
GREEN = 1667458930
NONE = 1667460719
ORANGE = 1667460978
OTHER = 1667460980
PURPLE = 1667461237
RED = 1667461733
YELLOW = 1667463525
class QuotingColor(value)[source]

Bases: Enum

Options for colors to use when quoting text.

Attributes:

BLUE

GREEN

ORANGE

OTHER

PURPLE

RED

YELLOW

BLUE = 1667457644
GREEN = 1667458930
ORANGE = 1667460978
OTHER = 1667460980
PURPLE = 1667461237
RED = 1667461733
YELLOW = 1667463525
class RuleQualifier(value)[source]

Bases: Enum

Options for how Mail rules are qualified.

Attributes:

BEGINS_WITH_VALUE

DOES_CONTAIN_VALUE

DOES_NOT_CONTAIN_VALUE

ENDS_WITH_VALUE

EQUAL_TO_VALUE

GREATER_THAN_VALUE

LESS_THAN_VALUE

NONE

Indicates no qualifier is applicable

BEGINS_WITH_VALUE = 1920033399
DOES_CONTAIN_VALUE = 1920033647
DOES_NOT_CONTAIN_VALUE = 1920033902
ENDS_WITH_VALUE = 1920034167
EQUAL_TO_VALUE = 1920035173
GREATER_THAN_VALUE = 1920034676
LESS_THAN_VALUE = 1920035956
NONE = 1920036463

Indicates no qualifier is applicable

class RuleType(value)[source]

Bases: Enum

Types of rules in Mail.app.

Attributes:

ACCOUNT

Account

ANY_RECIPIENT

Any recipient

ATTACHMENT_TYPE

Attachment Type

CC_HEADER

Cc header

FROM_HEADER

From header

HEADER_KEY

An arbitrary header key

MATCHES_EVERY_MESSAGE

Every message

MESSAGE_CONTENT

Message content

MESSAGE_IS_JUNK_MAIL

Message is junk mail

SENDER_IS_IN_MY_CONTACTS

Sender is in my contacts

SENDER_IS_IN_MY_PREVIOUS_RECIPIENTS

Sender is in my previous recipients

SENDER_IS_MEMBER_OF_GROUP

Sender is member of group

SENDER_IS_NOT_IN_MY_CONTACTS

Sender is not in my contacts

SENDER_IS_NOT_IN_MY_PREVIOUS_RECIPIENTS

sender is not in my previous recipients

SENDER_IS_NOT_MEMBER_OF_GROUP

Sender is not member of group

SENDER_IS_VIP

Sender is VIP

SUBJECT_HEADER

Subject header

TO_HEADER

To header

TO_OR_CC_HEADER

To or Cc header

ACCOUNT = 1952539491

Account

ANY_RECIPIENT = 1952542322

Any recipient

ATTACHMENT_TYPE = 1952543860

Attachment Type

CC_HEADER = 1952670563

Cc header

FROM_HEADER = 1952871023

From header

HEADER_KEY = 1952998507

An arbitrary header key

MATCHES_EVERY_MESSAGE = 1952806509

Every message

MESSAGE_CONTENT = 1953326435

Message content

MESSAGE_IS_JUNK_MAIL = 1953327466

Message is junk mail

SENDER_IS_IN_MY_CONTACTS = 1953720681

Sender is in my contacts

SENDER_IS_IN_MY_PREVIOUS_RECIPIENTS = 1953718632

Sender is in my previous recipients

SENDER_IS_MEMBER_OF_GROUP = 1953720685

Sender is member of group

SENDER_IS_NOT_IN_MY_CONTACTS = 1953720686

Sender is not in my contacts

SENDER_IS_NOT_IN_MY_PREVIOUS_RECIPIENTS = 1953390952

sender is not in my previous recipients

SENDER_IS_NOT_MEMBER_OF_GROUP = 1953720679

Sender is not member of group

SENDER_IS_VIP = 1953720679

Sender is VIP

SUBJECT_HEADER = 1953723746

Subject header

TO_HEADER = 1953787759

To header

TO_OR_CC_HEADER = 1953787747

To or Cc header

class ViewerColumn(value)[source]

Bases: Enum

Columns in message viewer windows.

Attributes:

ATTACHMENTS

Column containing the number of attachments a message contains

DATE_LAST_SAVED

Column containing the date a draft message was saved

DATE_RECEIVED

Column containing the date a message was received

DATE_SENT

Column containing the date a message was sent

FLAGS

Column containing the flags of a message

FROM

Column containing the sender's name

MAILBOX

Column containing the name of the mailbox or account a message is in

MESSAGE_COLOR

Used to indicate sorting should be done by color

MESSAGE_STATUS

Column indicating a messages status (read, unread, replied to, forwarded, etc)

NUMBER

Column containing the number of a message in a mailbox

RECIPIENTS

Column containing the recipients of a message

SIZE

Column containing the size of a message

SUBJECT

Column containing the subject of a message

ATTACHMENTS = 1701011828

Column containing the number of attachments a message contains

DATE_LAST_SAVED = 1701014643

Column containing the date a draft message was saved

DATE_RECEIVED = 1701012594

Column containing the date a message was received

DATE_SENT = 1701012595

Column containing the date a message was sent

FLAGS = 1701013100

Column containing the flags of a message

FROM = 1701013106

Column containing the sender’s name

MAILBOX = 1701014882

Column containing the name of the mailbox or account a message is in

MESSAGE_COLOR = 1701012332

Used to indicate sorting should be done by color

MESSAGE_STATUS = 1701014899

Column indicating a messages status (read, unread, replied to, forwarded, etc)

NUMBER = 1701015149

Column containing the number of a message in a mailbox

RECIPIENTS = 1701016687

Column containing the recipients of a message

SIZE = 1701016442

Column containing the size of a message

SUBJECT = 1701016437

Column containing the subject of a message

accounts(filter: dict | None = None) XAMailAccountList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

property always_bcc_myself: bool

Whether the user’s email address will be included in the Bcc: field of composed messages.

property always_cc_myself: bool

Whether the user’s email address will be included in the Cc: field of composed messages.

property application_version: str

The build number of Mail.app.

property background_activity_count: int

The number of background activities currently running in Mail.

check_for_new_mail(account: XAMailAccount) XAMailApplication[source]
property check_spelling_while_typing: bool

Whether spelling is checked automatically while composing messages.

property choose_signature_when_composing: bool

Whether the user can choose a signature directly in a new compose window.

property color_quoted_text: bool

Whether quoted text should be colored.

property default_message_format: Format

The default format for messages being composed.

property download_html_attachments: bool

Whether images and attachments in HTML messages should be downloaded and displayed.

property drafts_mailbox: XAMailbox

The top-level drafts mailbox.

property expand_group_addresses: bool

Whether group addresses should be expanded when entered into the address fields of a new message.

property fetch_interval: int

The number of minutes between automatic fetches for new mail (-1 = use automatically determined interval).

property fetches_automatically: bool

Whether mail will automatically be fetched at a specific interval.

property fixed_width_font: str

The name of the font used for plain text messages.

property fixed_width_font_size: int

The font size for plain text messages.

property frontmost: bool

Whether Mail is the active application.

property highlight_selected_conversation: bool

Whether messages in conversations should be highlighted in the Mail viewer window when not grouped.

imap_accounts(filter: dict | None = None) XAMailAccountList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

import_mailbox(file_path: str | NSURL) XAMailApplication[source]
property inbox: XAMailbox

The top-level inbox.

property include_all_original_message_text: bool

Whether all text of the original message will be quoted or only text the user selects.

property junk_mailbox: XAMailbox

The top-level junk mailbox.

property level_one_quoting_color: QuotingColor

Color for quoted text with one level of indentation.

property level_three_quoting_color: QuotingColor

Color for quoted text with three levels of indentation.

property level_two_quoting_color: QuotingColor

Color for quoted text with two levels of indentation.

mailboxes(filter: dict | None = None) XAMailboxList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

property message_font: str

The name of the font for messages.

property message_font_size: float

The font size for messages.

property message_list_font: str

The name of the font for the message list.

property message_list_font_size: float

The font size for the message list.

message_viewers(filter: dict | None = None) XAMailMessageViewerList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

property name: str

The name of the application.

property new_mail_sound: str

The name of the sound that plays when new mail is received, or “None”.

property outbox: XAMailbox

The top-level outbox.

outgoing_messages(filter: dict | None = None) XAMailAccountList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

pop_accounts(filter: dict | None = None) XAMailAccountList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

property primary_email: str

The user’s primary email address.

property quote_original_message: bool

Whether the text of the original message should be included in replies.

rules(filter: dict | None = None) XAMailRuleList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

property same_reply_format: bool

Whether replies will be in the same text format as the message to which the user is replying.

property selected_signature: str

The name of the currently selected signature (or “randomly”, “sequentially”, or “none”).

property selection: XAMailMessageList

The list of messages currently selected by the user.

property sent_mailbox: XAMailbox

The top-level sent mailbox.

property should_play_other_mail_sounds: bool

Whether sounds will be played for actions and events other than receiving email.

signatures(filter: dict | None = None) XAMailSignatureList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

smtp_servers(filter: dict | None = None) XAMailAccountList[source]

Returns a list of mail accounts matching the filter.

New in version 0.0.4.

synchronize(account: XAMailAccount) XAMailApplication[source]
property trash_mailbox: XAMailbox

The top-level trash mailbox.

property use_fixed_width_font: bool

Whether a fixed-width font should be used for plain text messages.

property version: str

The version number of Mail.app.

class PyXA.apps.Mail.XAMailAttachment(properties)[source]

Bases: XAObject

A class for managing and interacting with message attachments in Mail.app.

New in version 0.0.4.

Methods:

delete()

Permanently deletes the attachment.

Attributes:

downloaded

Whether the attachment has been downloaded.

file_size

The approximate size of the attachment in bytes.

id

The unique identifier for the attachment.

mime_type

The MIME type of the attachment, e.g. text/plain.

name

The name of the attachment.

delete()[source]

Permanently deletes the attachment.

New in version 0.0.4.

property downloaded: bool

Whether the attachment has been downloaded.

property file_size: int

The approximate size of the attachment in bytes.

property id: str

The unique identifier for the attachment.

property mime_type: str

The MIME type of the attachment, e.g. text/plain.

property name: str

The name of the attachment.

class PyXA.apps.Mail.XAMailAttachmentList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of attachments that employs fast enumeration techniques.

All properties of attachments can be called as methods on the wrapped list, returning a list containing each attachment’s value for the property.

New in version 0.0.4.

Methods:

by_downloaded(downloaded)

by_file_size(file_size)

by_id(id)

by_mime_type(mime_type)

by_name(name)

downloaded()

file_size()

id()

mime_type()

name()

by_downloaded(downloaded: bool) XAMailAttachment[source]
by_file_size(file_size: int) XAMailAttachment[source]
by_id(id: str) XAMailAttachment[source]
by_mime_type(mime_type: str) XAMailAttachment[source]
by_name(name: str) XAMailAttachment[source]
downloaded() list[bool][source]
file_size() list[int][source]
id() list[str][source]
mime_type() list[str][source]
name() list[str][source]
class PyXA.apps.Mail.XAMailBccRecipient(properties)[source]

Bases: XAMailRecipient

A class for managing and interacting with BCC recipients in Mail.app.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailBccRecipientList(properties: dict, filter: dict | None = None)[source]

Bases: XAMailRecipientList

A wrapper around lists of mail Bcc recipients that employs fast enumeration techniques.

All properties of Bcc recipients can be called as methods on the wrapped list, returning a list containing each recipients’s value for the property.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailCcRecipient(properties)[source]

Bases: XAMailRecipient

A class for managing and interacting with CC recipients in Mail.app.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailCcRecipientList(properties: dict, filter: dict | None = None)[source]

Bases: XAMailRecipientList

A wrapper around lists of mail Cc recipients that employs fast enumeration techniques.

All properties of Cc recipients can be called as methods on the wrapped list, returning a list containing each recipients’s value for the property.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailContainer(properties)[source]

Bases: XAMailbox

A class for managing and interacting with containers in Mail.app. Containers are mailboxes that contain other mailboxes.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailContainerList(properties: dict, filter: dict | None = None)[source]

Bases: XAMailboxList

A wrapper around lists of mail headers that employs fast enumeration techniques.

All properties of headers can be called as methods on the wrapped list, returning a list containing each header’s value for the property.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailDocument(properties)[source]

Bases: XAObject

A class for managing and interacting with Mail documents.

New in version 0.0.4.

Methods:

delete()

Permanently deletes the document.

Attributes:

file

The location of the document on the disk, if one exists.

modified

Whether the document has been modified since the last save.

name

The name of the document.

delete()[source]

Permanently deletes the document.

New in version 0.0.4.

property file: str

The location of the document on the disk, if one exists.

property modified: bool

Whether the document has been modified since the last save.

property name: str

The name of the document.

class PyXA.apps.Mail.XAMailDocumentList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of mail documents that employs fast enumeration techniques.

All properties of documents can be called as methods on the wrapped list, returning a list containing each document’s value for the property.

New in version 0.0.4.

Methods:

by_file(file)

by_modified(modified)

by_name(name)

file()

modified()

name()

by_file(file: str) XAMailDocument[source]
by_modified(modified: bool) XAMailDocument[source]
by_name(name: str) XAMailDocument[source]
file() list[str][source]
modified() list[bool][source]
name() list[str][source]
class PyXA.apps.Mail.XAMailHeader(properties)[source]

Bases: XAObject

A class for managing and interacting with message headers in Mail.app.

New in version 0.0.4.

Attributes:

content

The contents of the header.

name

The name of the header value.

property content: str

The contents of the header.

property name: str

The name of the header value.

class PyXA.apps.Mail.XAMailHeaderList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of mail headers that employs fast enumeration techniques.

All properties of headers can be called as methods on the wrapped list, returning a list containing each header’s value for the property.

New in version 0.0.4.

Methods:

by_content(content)

by_name(name)

content()

name()

by_content(content: str) XAMailHeader[source]
by_name(name: str) XAMailHeader[source]
content() list[str][source]
name() list[str][source]
class PyXA.apps.Mail.XAMailICloudAccount(properties)[source]

Bases: XAMailAccount

A class for managing and interacting with iCloud accounts in Mail.app.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailICloudAccountList(properties: dict, filter: dict | None = None)[source]

Bases: XAMailAccountList

A wrapper around lists of iCloud accounts that employs fast enumeration techniques.

All properties of iCloud accounts can be called as methods on the wrapped list, returning a list containing each accounts’s value for the property.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailIMAPAccount(properties)[source]

Bases: XAMailAccount

A class for managing and interacting with IMAP accounts in Mail.app.

New in version 0.0.4.

Attributes:

compact_mailboxes_when_closing

Whether an IMAP mailbox is automatically compacted when the user quits Mail.app or switches to another mailbox.

message_caching

The message caching setting for the account.

store_deleted_messages_on_server

Whether deleted messages will be stored on the IMAP server.

store_drafts_on_server

Whether draft messages will be stored on the IMAP server.

store_junk_mail_on_server

Whether junk mail will be stored on the IMAP server.

store_sent_messages_on_server

Whether sent messages will be stored on the IMAP server.

property compact_mailboxes_when_closing: bool

Whether an IMAP mailbox is automatically compacted when the user quits Mail.app or switches to another mailbox.

property message_caching: CachingPolicy

The message caching setting for the account.

property store_deleted_messages_on_server: bool

Whether deleted messages will be stored on the IMAP server.

property store_drafts_on_server: bool

Whether draft messages will be stored on the IMAP server.

property store_junk_mail_on_server: bool

Whether junk mail will be stored on the IMAP server.

property store_sent_messages_on_server: bool

Whether sent messages will be stored on the IMAP server.

class PyXA.apps.Mail.XAMailIMAPAccountList(properties: dict, filter: dict | None = None)[source]

Bases: XAMailAccountList

A wrapper around lists of mail documents that employs fast enumeration techniques.

All properties of documents can be called as methods on the wrapped list, returning a list containing each document’s value for the property.

New in version 0.0.4.

Methods:

by_compact_mailboxes_when_closing(...)

by_message_caching(message_caching)

by_store_deleted_messages_on_server(...)

by_store_drafts_on_server(store_drafts_on_server)

by_store_junk_mail_on_server(...)

by_store_sent_messages_on_server(...)

compact_mailboxes_when_closing()

message_caching()

store_deleted_messages_on_server()

store_drafts_on_server()

store_junk_mail_on_server()

store_sent_messages_on_server()

by_compact_mailboxes_when_closing(compact_mailboxes_when_closing: bool) XAMailPOPAccount[source]
by_message_caching(message_caching: CachingPolicy) XAMailPOPAccount[source]
by_store_deleted_messages_on_server(store_deleted_messages_on_server: bool) XAMailPOPAccount[source]
by_store_drafts_on_server(store_drafts_on_server: bool) XAMailPOPAccount[source]
by_store_junk_mail_on_server(store_junk_mail_on_server: bool) XAMailPOPAccount[source]
by_store_sent_messages_on_server(store_sent_messages_on_server: bool) XAMailPOPAccount[source]
compact_mailboxes_when_closing() list[bool][source]
message_caching() list[CachingPolicy][source]
store_deleted_messages_on_server() list[bool][source]
store_drafts_on_server() list[bool][source]
store_junk_mail_on_server() list[bool][source]
store_sent_messages_on_server() list[bool][source]
class PyXA.apps.Mail.XAMailMessage(properties)[source]

Bases: XAObject

A class for managing and interacting with messages in Mail.app.

New in version 0.0.4.

Attributes:

all_headers

The headers of the message.

background_color

The background color of the message.

content

The contents of the message.

date_received

The date and time that the message was received.

date_sent

The date and time that the message was sent.

deleted_status

Whether the message is deleted.

flag_index

The flag on the message, or -1 if the message is not flagged.

flagged_status

Whether the message is flagged.

id

The unique identifier for the message.

junk_mail_status

Whether the message is marked as junk.

mailbox

The mailbox in which the message is located.

message_id

The unique message ID string.

message_size

The size of the message in bytes.

read_status

Whether the message has been read.

reply_to

The address that replies should be sent to.

sender

The address of the sender of the message.

source

The raw source of the message.

subject

The subject string of the message.

was_forward

Whether the message was forwarded.

was_redirected

Whether the message was redirected.

was_replied_to

Whether the message was replied to.

Methods:

bcc_recipients([filter])

Returns a list of Bcc recipients matching the filter.

cc_recpients([filter])

Returns a list of Cc recipients matching the filter.

delete()

Permanently deletes the message.

forward([open_window])

headers([filter])

Returns a list of message headers matching the filter.

mail_attachments([filter])

Returns a list of message attachments matching the filter.

open()

Opens the message in a separate window.

recipients([filter])

Returns a list of mail recipients matching the filter.

redirect([open_window])

reply([open_window, reply_all])

to_recipients([filter])

Returns a list of primary recipients matching the filter.

property all_headers: str

The headers of the message.

property background_color: HighlightColor

The background color of the message.

bcc_recipients(filter: dict | None = None) XAMailBccRecipientList[source]

Returns a list of Bcc recipients matching the filter.

New in version 0.0.4.

cc_recpients(filter: dict | None = None) XAMailCcRecipientList[source]

Returns a list of Cc recipients matching the filter.

New in version 0.0.4.

property content: XAText

The contents of the message.

property date_received: datetime

The date and time that the message was received.

property date_sent: datetime

The date and time that the message was sent.

delete()[source]

Permanently deletes the message.

New in version 0.0.4.

property deleted_status: bool

Whether the message is deleted.

property flag_index: int

The flag on the message, or -1 if the message is not flagged.

property flagged_status: bool

Whether the message is flagged.

forward(open_window: bool = True) XAMailOutgoingMessage[source]
headers(filter: dict | None = None) XAMailHeaderList[source]

Returns a list of message headers matching the filter.

New in version 0.0.4.

property id: int

The unique identifier for the message.

property junk_mail_status: bool

Whether the message is marked as junk.

mail_attachments(filter: dict | None = None) XAMailAttachmentList[source]

Returns a list of message attachments matching the filter.

New in version 0.0.4.

property mailbox: XAMailbox

The mailbox in which the message is located.

property message_id: int

The unique message ID string.

property message_size: int

The size of the message in bytes.

open() XAMailMessage[source]

Opens the message in a separate window.

Returns:

A reference to the message object.

Return type:

XAMailMessage

New in version 0.0.4.

property read_status: bool

Whether the message has been read.

recipients(filter: dict | None = None) XAMailRecipientList[source]

Returns a list of mail recipients matching the filter.

New in version 0.0.4.

redirect(open_window: bool = True) XAMailOutgoingMessage[source]
reply(open_window: bool = True, reply_all: bool = False) XAMailOutgoingMessage[source]
property reply_to: str

The address that replies should be sent to.

property sender: str

The address of the sender of the message.

property source: str

The raw source of the message.

property subject: str

The subject string of the message.

to_recipients(filter: dict | None = None) XAMailToRecipientList[source]

Returns a list of primary recipients matching the filter.

New in version 0.0.4.

property was_forward: bool

Whether the message was forwarded.

property was_redirected: bool

Whether the message was redirected.

property was_replied_to: bool

Whether the message was replied to.

class PyXA.apps.Mail.XAMailMessageList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of messages that employs fast enumeration techniques.

All properties of messages can be called as methods on the wrapped list, returning a list containing each message’s value for the property.

New in version 0.0.4.

Methods:

all_headers()

background_color()

by_all_headers(all_headers)

by_background_color(background_color)

by_content(content)

by_date_received(date_received)

by_date_sent(date_sent)

by_deleted_status(deleted_status)

by_flag_index(flag_index)

by_flagged_status(flagged_status)

by_id(id)

by_junk_mail_status(junk_mail_status)

by_mailbox(mailbox)

by_message_id(message_id)

by_message_size(message_size)

by_read_status(read_status)

by_reply_to(reply_to)

by_sender(sender)

by_source(source)

by_subject(subject)

by_was_forwarded(was_forwarded)

by_was_redirected(was_redirected)

by_was_replied_to(was_replied_to)

content()

date_received()

date_sent()

deleted_status()

flag_index()

flagged_status()

id()

junk_mail_status()

mailbox()

message_id()

message_size()

read_status()

reply_to()

sender()

source()

subject()

was_forwarded()

was_redirected()

was_replied_to()

all_headers() list[str][source]
background_color() list[HighlightColor][source]
by_all_headers(all_headers: str) XAMailMessage[source]
by_background_color(background_color: HighlightColor) XAMailMessage[source]
by_content(content: XAText) XAMailMessage[source]
by_date_received(date_received: datetime) XAMailMessage[source]
by_date_sent(date_sent: datetime) XAMailMessage[source]
by_deleted_status(deleted_status: bool) XAMailMessage[source]
by_flag_index(flag_index: int) XAMailMessage[source]
by_flagged_status(flagged_status: bool) XAMailMessage[source]
by_id(id: int) XAMailMessage[source]
by_junk_mail_status(junk_mail_status: bool) XAMailMessage[source]
by_mailbox(mailbox: XAMailbox) XAMailMessage[source]
by_message_id(message_id: str) XAMailMessage[source]
by_message_size(message_size: int) XAMailMessage[source]
by_read_status(read_status: bool) XAMailMessage[source]
by_reply_to(reply_to: str) XAMailMessage[source]
by_sender(sender: str) XAMailMessage[source]
by_source(source: str) XAMailMessage[source]
by_subject(subject: str) XAMailMessage[source]
by_was_forwarded(was_forwarded: bool) XAMailMessage[source]
by_was_redirected(was_redirected: bool) XAMailMessage[source]
by_was_replied_to(was_replied_to: bool) XAMailMessage[source]
content() list[str][source]
date_received() list[datetime][source]
date_sent() list[datetime][source]
deleted_status() list[bool][source]
flag_index() list[int][source]
flagged_status() list[bool][source]
id() list[int][source]
junk_mail_status() list[bool][source]
mailbox() XAMailboxList[source]
message_id() list[str][source]
message_size() list[int][source]
read_status() list[bool][source]
reply_to() list[str][source]
sender() list[str][source]
source() list[str][source]
subject() list[str][source]
was_forwarded() list[bool][source]
was_redirected() list[bool][source]
was_replied_to() list[bool][source]
class PyXA.apps.Mail.XAMailMessageViewer(properties)[source]

Bases: XAObject

A class for managing and interacting with the message viewer window in Mail.app.

New in version 0.0.4.

Attributes:

drafts_mailbox

The top-level Drafts mailbox.

id

The unique identifier of the message viewer.

inbox

The top-level Inbox mailbox.

junk_mailbox

The top-level Junk mailbox.

mailbox_list_visible

Controls whether the list of mailboxes is visible or not.

outbox

The top-level Out mailbox.

preview_pane_is_visible

Controls whether the preview pane of the message viewer window is visible or not.

selected_mailboxes

List of mailboxes currently selected in the list of mailboxes.

selected_messages

List of messages currently selected.

sent_mailbox

The top-level Sent mailbox.

sort_ascending

Whether the viewer is sorted ascending or not.

sort_column

The column that is currently sorted in the viewer.

trash_mailbox

The top-level Trash mailbox.

visible_columns

List of columns that are visible.

visible_messages

List of messages currently being displayed in the viewer.

window

The window for the message viewer.

Methods:

messages([filter])

Returns a list of messages matching the filter.

property drafts_mailbox: XAMailbox

The top-level Drafts mailbox.

property id: int

The unique identifier of the message viewer.

property inbox: XAMailbox

The top-level Inbox mailbox.

property junk_mailbox: XAMailbox

The top-level Junk mailbox.

property mailbox_list_visible: bool

Controls whether the list of mailboxes is visible or not.

messages(filter: dict | None = None) XAMailMessageList[source]

Returns a list of messages matching the filter.

New in version 0.0.4.

property outbox: XAMailbox

The top-level Out mailbox.

property preview_pane_is_visible: bool

Controls whether the preview pane of the message viewer window is visible or not.

property selected_mailboxes: XAMailboxList

List of mailboxes currently selected in the list of mailboxes.

property selected_messages: XAMailMessageList

List of messages currently selected.

property sent_mailbox: XAMailbox

The top-level Sent mailbox.

property sort_ascending: bool

Whether the viewer is sorted ascending or not.

property sort_column: ViewerColumn

The column that is currently sorted in the viewer.

property trash_mailbox: XAMailbox

The top-level Trash mailbox.

property visible_columns: list[str]

List of columns that are visible. The subject column and the message status column will always be visible.

property visible_messages: XAMailMessageList

List of messages currently being displayed in the viewer.

property window: XAMailWindow

The window for the message viewer.

class PyXA.apps.Mail.XAMailMessageViewerList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of mail signatures that employs fast enumeration techniques.

All properties of signatures can be called as methods on the wrapped list, returning a list containing each signature’s value for the property.

New in version 0.0.4.

Methods:

by_drafts_mailbox(drafts_mailbox)

by_id(id)

by_inbox(inbox)

by_junk_mailbox(junk_mailbox)

by_mailbox_list_visible(mailbox_list_visible)

by_outbox(outbox)

by_preview_pane_is_visible(...)

by_selected_mailboxes(selected_mailboxes)

by_selected_messages(selected_messages)

by_sent_mailbox(sent_mailbox)

by_sort_column(sort_column)

by_sorted_ascending(sorted_ascending)

by_trash_mailbox(trash_mailbox)

by_visible_columns(visible_columns)

by_visible_messages(visible_messages)

by_window(window)

drafts_mailbox()

id()

inbox()

junk_mailbox()

mailbox_list_visible()

outbox()

preview_pane_is_visible()

selected_mailboxes()

selected_messages()

sent_mailbox()

sort_column()

sorted_ascending()

trash_mailbox()

visible_columns()

visible_messages()

window()

by_drafts_mailbox(drafts_mailbox: XAMailbox) XAMailMessageViewer | None[source]
by_id(id: int) XAMailMessageViewer | None[source]
by_inbox(inbox: XAMailbox) XAMailMessageViewer | None[source]
by_junk_mailbox(junk_mailbox: XAMailbox) XAMailMessageViewer | None[source]
by_mailbox_list_visible(mailbox_list_visible: bool) XAMailMessageViewer | None[source]
by_outbox(outbox: XAMailbox) XAMailMessageViewer | None[source]
by_preview_pane_is_visible(preview_pane_is_visible: bool) XAMailMessageViewer | None[source]
by_selected_mailboxes(selected_mailboxes: XAMailboxList) XAMailMessageViewer | None[source]
by_selected_messages(selected_messages: XAMailMessageList) XAMailMessageViewer | None[source]
by_sent_mailbox(sent_mailbox: XAMailbox) XAMailMessageViewer | None[source]
by_sort_column(sort_column: ViewerColumn) XAMailMessageViewer | None[source]
by_sorted_ascending(sorted_ascending: bool) XAMailMessageViewer | None[source]
by_trash_mailbox(trash_mailbox: XAMailbox) XAMailMessageViewer | None[source]
by_visible_columns(visible_columns: list[str]) XAMailMessageViewer | None[source]
by_visible_messages(visible_messages: XAMailMessageList) XAMailMessageViewer | None[source]
by_window(window: XAMailWindow) XAMailMessageViewer | None[source]
drafts_mailbox() XAMailboxList[source]
id() list[str][source]
inbox() XAMailboxList[source]
junk_mailbox() XAMailboxList[source]
mailbox_list_visible() list[bool][source]
outbox() XAMailboxList[source]
preview_pane_is_visible() list[bool][source]
selected_mailboxes() list[XAMailboxList][source]
selected_messages() list[XAMailMessageList][source]
sent_mailbox() XAMailboxList[source]
sort_column() list[ViewerColumn][source]
sorted_ascending() list[bool][source]
trash_mailbox() XAMailboxList[source]
visible_columns() list[list[str]][source]
visible_messages() list[XAMailMessageList][source]
window() XASBWindowList[source]
class PyXA.apps.Mail.XAMailOutgoingMessage(properties)[source]

Bases: XAObject

A class for managing and interacting with outgoing messages in Mail.app.

New in version 0.0.4.

Methods:

close([save])

delete()

Permanently deletes the outgoing message.

save()

send()

Attributes:

content

The contents of the message.

id

The unique identifier for the message.

message_signature

The signature of the message.

sender

The address of the message sender.

subject

The subject string of the message.

visible

Whether the message window is shown on screen.

close(save: SaveOption = SaveOption.YES)[source]
property content: XAText

The contents of the message.

delete()[source]

Permanently deletes the outgoing message.

New in version 0.0.4.

property id: int

The unique identifier for the message.

property message_signature: XAMailSignature

The signature of the message.

save()[source]
send() bool[source]
property sender: str

The address of the message sender.

property subject: str

The subject string of the message.

property visible: bool

Whether the message window is shown on screen.

class PyXA.apps.Mail.XAMailOutgoingMessageList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of outgoing messages that employs fast enumeration techniques.

All properties of outgoing messages can be called as methods on the wrapped list, returning a list containing each messages’s value for the property.

New in version 0.0.4.

Methods:

by_content(content)

by_id(id)

by_message_signature(message_signature)

by_sender(sender)

by_subject(subject)

by_visible(visible)

content()

id()

message_signature()

sender()

subject()

visible()

by_content(content: XAText) XAMailOutgoingMessage[source]
by_id(id: int) XAMailOutgoingMessage[source]
by_message_signature(message_signature: XAMailSignature) XAMailOutgoingMessage[source]
by_sender(sender: str) XAMailOutgoingMessage[source]
by_subject(subject: str) XAMailOutgoingMessage[source]
by_visible(visible: bool) XAMailOutgoingMessage[source]
content() XATextList[source]
id() list[int][source]
message_signature() XAMailSignatureList[source]
sender() list[str][source]
subject() list[str][source]
visible() list[bool][source]
class PyXA.apps.Mail.XAMailPOPAccount(properties)[source]

Bases: XAMailAccount

A class for managing and interacting with POP accounts in Mail.app.

New in version 0.0.4.

Attributes:

big_message_warning_size

The max amount of bytes a message can be before Mail will prompt the user before downloading the message (-1 = do not prompt).

delayed_message_deletion_interval

The number of days before messages that have been downloaded will be deleted from the server (0 = delete immediately after downloading).

delete_mail_on_server

Whether the POP account deletes messages on the server after downloading.

delete_messages_when_moved_from_inbox

Whether messages will be deleted from the server when moved from the POP inbox.

property big_message_warning_size: int

The max amount of bytes a message can be before Mail will prompt the user before downloading the message (-1 = do not prompt).

property delayed_message_deletion_interval: int

The number of days before messages that have been downloaded will be deleted from the server (0 = delete immediately after downloading).

property delete_mail_on_server: bool

Whether the POP account deletes messages on the server after downloading.

property delete_messages_when_moved_from_inbox: bool

Whether messages will be deleted from the server when moved from the POP inbox.

class PyXA.apps.Mail.XAMailPOPAccountList(properties: dict, filter: dict | None = None)[source]

Bases: XAMailAccountList

A wrapper around lists of mail documents that employs fast enumeration techniques.

All properties of documents can be called as methods on the wrapped list, returning a list containing each document’s value for the property.

New in version 0.0.4.

Methods:

big_message_warning_size()

by_big_message_warning_size(...)

by_delayed_message_deletion_interval(...)

by_delete_mail_on_server(delete_mail_on_server)

by_delete_messages_when_moved_from_inbox(...)

delayed_message_deletion_interval()

delete_mail_on_server()

delete_messages_when_moved_from_inbox()

big_message_warning_size() list[int][source]
by_big_message_warning_size(big_message_warning_size: int) XAMailPOPAccount[source]
by_delayed_message_deletion_interval(delayed_message_deletion_interval: int) XAMailPOPAccount[source]
by_delete_mail_on_server(delete_mail_on_server: bool) XAMailPOPAccount[source]
by_delete_messages_when_moved_from_inbox(delete_messages_when_moved_from_inbox: bool) XAMailPOPAccount[source]
delayed_message_deletion_interval() list[int][source]
delete_mail_on_server() list[bool][source]
delete_messages_when_moved_from_inbox() list[bool][source]
class PyXA.apps.Mail.XAMailRecipient(properties)[source]

Bases: XAObject

A class for managing and interacting with recipients in Mail.app.

New in version 0.0.4.

Attributes:

address

The recipient's email address.

name

The name used for display.

property address: str

The recipient’s email address.

property name: str

The name used for display.

class PyXA.apps.Mail.XAMailRecipientList(properties: dict, filter: dict | None = None, object_class=None)[source]

Bases: XAList

A wrapper around lists of mail recipients that employs fast enumeration techniques.

All properties of recipients can be called as methods on the wrapped list, returning a list containing each recipients’s value for the property.

New in version 0.0.4.

Methods:

address()

by_address(address)

by_name(name)

name()

address() list[str][source]
by_address(address: str) XAMailRecipient[source]
by_name(name: str) XAMailRecipient[source]
name() list[str][source]
class PyXA.apps.Mail.XAMailRule(properties)[source]

Bases: XAObject

A class for managing and interacting with rules in Mail.app.

New in version 0.0.4.

Attributes:

all_conditions_must_be_met

Whether all conditions must be met for the rule to execute.

color_message

If the rule matches, apply this color.

copy_message

If the rule matches, copy the message to the specified mailbox.

delete_message

If the rule matches, delete the message.

enabled

Whether the rule is enabled.

forward_message

If the rule matches, forward the message to the specified addresses, separated by commas.

forward_text

If the rule matches, prepend the provided text to the forwarded message.

highlight_text_using_color

Whether the color will be used to highlight the text of background of a message.

mark_flag_index

If the rule matches, mark the message with the specified flag (-1 = disabled).

mark_flagged

If the rule matches, mark the message as flagged.

mark_read

If the rule matches, mark the message as read.

move_message

If the rule matches, move the message to the specified mailbox.

name

The name of the rule.

play_sound

If the rule matches, play the sound specified by name or path.

redirect_message

If the rule matches, redirect the message to the supplied addresses, separated by commas.

reply_text

If the rule matches, reply to the message and prepend the provided text.

run_script

If the rule matches, run the supplied AppleScript file.

should_copy_message

Whether the rule has a copy action.

should_move_message

Whether the rule has a move action.

stop_evaluating_rule

If the rule matches, stop rule evaluation for the message

stop_evaluating_rules

If the rule matches, stop rule evaluation for the message

Methods:

delete()

Permanently deletes the rule.

rule_conditions([filter])

Returns a list of rule conditions matching the filter.

property all_conditions_must_be_met: bool

Whether all conditions must be met for the rule to execute.

property color_message: HighlightColor

If the rule matches, apply this color.

property copy_message: XAMailbox

If the rule matches, copy the message to the specified mailbox.

delete()[source]

Permanently deletes the rule.

New in version 0.0.4.

property delete_message: bool

If the rule matches, delete the message.

property enabled: bool

Whether the rule is enabled.

property forward_message: str

If the rule matches, forward the message to the specified addresses, separated by commas.

property forward_text: str

If the rule matches, prepend the provided text to the forwarded message.

property highlight_text_using_color: bool

Whether the color will be used to highlight the text of background of a message.

property mark_flag_index: int

If the rule matches, mark the message with the specified flag (-1 = disabled).

property mark_flagged: bool

If the rule matches, mark the message as flagged.

property mark_read: bool

If the rule matches, mark the message as read.

property move_message: XAMailbox

If the rule matches, move the message to the specified mailbox.

property name: str

The name of the rule.

property play_sound: str

If the rule matches, play the sound specified by name or path.

property redirect_message: str

If the rule matches, redirect the message to the supplied addresses, separated by commas.

property reply_text: str

If the rule matches, reply to the message and prepend the provided text.

rule_conditions(filter: dict | None = None) XAMailRuleConditionList[source]

Returns a list of rule conditions matching the filter.

New in version 0.0.4.

property run_script: str

If the rule matches, run the supplied AppleScript file.

property should_copy_message: bool

Whether the rule has a copy action.

property should_move_message: bool

Whether the rule has a move action.

property stop_evaluating_rule: bool

If the rule matches, stop rule evaluation for the message

property stop_evaluating_rules: bool

If the rule matches, stop rule evaluation for the message

class PyXA.apps.Mail.XAMailRuleCondition(properties)[source]

Bases: XAObject

A class for managing and interacting with rule conditions in Mail.app.

New in version 0.0.4.

Methods:

delete()

Permanently deletes the rule condition.

Attributes:

expression

The rule expression field.

header

The rule header key.

qualifier

The qualifier for the rule.

rule_type

The type of the rule.

delete()[source]

Permanently deletes the rule condition.

New in version 0.0.4.

property expression: str

The rule expression field.

property header: str

The rule header key.

property qualifier: RuleQualifier

The qualifier for the rule.

property rule_type: RuleType

The type of the rule.

class PyXA.apps.Mail.XAMailRuleConditionList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of rule conditions that employs fast enumeration techniques.

All properties of rule conditions can be called as methods on the wrapped list, returning a list containing each rule conditions’s value for the property.

New in version 0.0.4.

Methods:

by_expression(expression)

by_header(header)

by_qualifier(qualifier)

by_rule_type(rule_type)

expression()

header()

qualifier()

rule_type()

by_expression(expression: str) XAMailRuleCondition | None[source]
by_header(header: str) XAMailRuleCondition | None[source]
by_qualifier(qualifier: RuleQualifier) XAMailRuleCondition | None[source]
by_rule_type(rule_type: RuleType) XAMailRuleCondition | None[source]
expression() list[str][source]
header() list[str][source]
qualifier() list[RuleQualifier][source]
rule_type() list[RuleType][source]
class PyXA.apps.Mail.XAMailRuleList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of rules that employs fast enumeration techniques.

All properties of rules can be called as methods on the wrapped list, returning a list containing each rule’s value for the property.

New in version 0.0.4.

Methods:

all_conditions_must_be_met()

by_all_conditions_must_be_met(...)

by_color_message(color_message)

by_copy_message(copy_message)

by_delete_message(deleteMessage)

by_enabled(enabled)

by_forward_message(forward_message)

by_forward_text(forward_text)

by_highlight_text_using_color(...)

by_mark_flag_index(mark_flag_index)

by_mark_flagged(mark_flagged)

by_mark_read(mark_read)

by_move_message(move_message)

by_name(name)

by_play_sound(play_sound)

by_redirect_message(redirect_message)

by_reply_text(reply_text)

by_run_script(run_script)

by_should_copy_message(should_copy_message)

by_should_move_message(should_move_message)

by_stop_evaluating_rules(stop_evaluating_rules)

color_message()

copy_message()

delete_message()

enabled()

forward_message()

forward_text()

highlight_text_using_color()

mark_flag_index()

mark_flagged()

mark_read()

move_message()

name()

play_sound()

redirect_message()

reply_text()

run_script()

should_copy_message()

should_move_message()

stop_evaluating_rules()

all_conditions_must_be_met() list[bool][source]
by_all_conditions_must_be_met(all_conditions_must_be_met: bool) XAMailRule[source]
by_color_message(color_message: HighlightColor) XAMailRule[source]
by_copy_message(copy_message: XAMailbox) XAMailRule[source]
by_delete_message(deleteMessage: bool) XAMailRule[source]
by_enabled(enabled: bool) XAMailRule[source]
by_forward_message(forward_message: str) XAMailRule[source]
by_forward_text(forward_text: str) XAMailRule[source]
by_highlight_text_using_color(highlight_text_using_color: bool) XAMailRule[source]
by_mark_flag_index(mark_flag_index: int) XAMailRule[source]
by_mark_flagged(mark_flagged: bool) XAMailRule[source]
by_mark_read(mark_read: bool) XAMailRule[source]
by_move_message(move_message: XAMailbox) XAMailRule[source]
by_name(name: str) XAMailRule[source]
by_play_sound(play_sound: str) XAMailRule[source]
by_redirect_message(redirect_message: str) XAMailRule[source]
by_reply_text(reply_text: str) XAMailRule[source]
by_run_script(run_script: str) XAMailRule[source]
by_should_copy_message(should_copy_message: bool) XAMailRule[source]
by_should_move_message(should_move_message: bool) XAMailRule[source]
by_stop_evaluating_rules(stop_evaluating_rules: bool) XAMailRule[source]
color_message() list[HighlightColor][source]
copy_message() XAMailboxList[source]
delete_message() list[bool][source]
enabled() list[bool][source]
forward_message() list[str][source]
forward_text() list[str][source]
highlight_text_using_color() list[bool][source]
mark_flag_index() list[int][source]
mark_flagged() list[bool][source]
mark_read() list[bool][source]
move_message() XAMailboxList[source]
name() list[str][source]
play_sound() list[str][source]
redirect_message() list[str][source]
reply_text() list[str][source]
run_script() list[str][source]
should_copy_message() list[bool][source]
should_move_message() list[bool][source]
stop_evaluating_rules() list[bool][source]
class PyXA.apps.Mail.XAMailSMTPServer(properties)[source]

Bases: XAObject

A class for managing and interacting with SMTP servers in Mail.app.

New in version 0.0.4.

Attributes:

account_type

The type of the account, either: "pop", "smtp", "imap", or "iCloud".

authentication

The preferred authentication scheme for the account, either: "password", "apop", "kerberos 5", "ntlm", "md5", "external", "Apple token", or "none".

enabled

Whether the account is enabled.

name

The name of the account.

password

The password for the account.

port

The port used to connect to the account.

server_name

The host name used to connect to the account.

user_name

The user name used to connect to the account.

uses_ssl

Whether SSL is enabled for this receiving account.

property account_type: AccountType

The type of the account, either: “pop”, “smtp”, “imap”, or “iCloud”.

property authentication: AuthenticationMethod

The preferred authentication scheme for the account, either: “password”, “apop”, “kerberos 5”, “ntlm”, “md5”, “external”, “Apple token”, or “none”.

property enabled: bool

Whether the account is enabled.

property name: str

The name of the account.

property password: None

The password for the account.

property port: int

The port used to connect to the account.

property server_name: str

The host name used to connect to the account.

property user_name: str

The user name used to connect to the account.

property uses_ssl: bool

Whether SSL is enabled for this receiving account.

class PyXA.apps.Mail.XAMailSMTPServerList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of SMTP servers that employs fast enumeration techniques.

All properties of SMTP servers can be called as methods on the wrapped list, returning a list containing each SMTP server’s value for the property.

New in version 0.0.4.

Methods:

account_type()

authentication()

by_account_type(account_type)

by_authentication(authentication)

by_enabled(enabled)

by_name(name)

by_port(port)

by_server_name(server_name)

by_user_name(user_name)

by_uses_ssl(uses_ssl)

enabled()

name()

port()

server_name()

user_name()

uses_ssl()

account_type() list[AccountType][source]
authentication() list[AuthenticationMethod][source]
by_account_type(account_type: AccountType) XAMailAccount[source]
by_authentication(authentication: AuthenticationMethod) XAMailAccount[source]
by_enabled(enabled: bool) XAMailAccount[source]
by_name(name: str) XAMailAccount[source]
by_port(port: int) XAMailAccount[source]
by_server_name(server_name: str) XAMailAccount[source]
by_user_name(user_name: str) XAMailAccount[source]
by_uses_ssl(uses_ssl: bool) XAMailAccount[source]
enabled() list[bool][source]
name() list[str][source]
port() list[int][source]
server_name() list[str][source]
user_name() list[str][source]
uses_ssl() list[bool][source]
class PyXA.apps.Mail.XAMailSignature(properties)[source]

Bases: XAObject

A class for managing and interacting with email signatures in Mail.app.

New in version 0.0.4.

Attributes:

content

The content of the email signature.

name

The name of the signature.

Methods:

delete()

Permanently deletes the signature.

property content: XAText

The content of the email signature.

delete()[source]

Permanently deletes the signature.

New in version 0.0.4.

property name: str

The name of the signature.

class PyXA.apps.Mail.XAMailSignatureList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of mail signatures that employs fast enumeration techniques.

All properties of signatures can be called as methods on the wrapped list, returning a list containing each signature’s value for the property.

New in version 0.0.4.

Methods:

by_content(content)

by_name(name)

content()

name()

by_content(content: XAText) XAMailSignature | None[source]
by_name(name: str) XAMailSignature | None[source]
content() list[XAText][source]
name() list[str][source]
class PyXA.apps.Mail.XAMailToRecipient(properties)[source]

Bases: XAMailRecipient

A class for managing and interacting with the primary (to) recipients in Mail.app.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailToRecipientList(properties: dict, filter: dict | None = None)[source]

Bases: XAMailRecipientList

A wrapper around lists of mail primary (to) recipients that employs fast enumeration techniques.

All properties of primary recipients can be called as methods on the wrapped list, returning a list containing each recipients’s value for the property.

New in version 0.0.4.

class PyXA.apps.Mail.XAMailWindow(properties)[source]

Bases: XASBWindow

A class for managing and interacting with Mail documents.

New in version 0.0.4.

Attributes:

document

The current document.

property document: XAMailDocument

The current document.

class PyXA.apps.Mail.XAMailbox(properties)[source]

Bases: XAObject

A class for managing and interacting with mailboxes in Mail.app.

New in version 0.0.4.

Attributes:

account

The parent account of the mailbox.

container

The parent mailbox of the mailbox.

name

The name of the mailbox.

unread_count

The number of unread messages in the mailbox.

Methods:

delete()

Permanently deletes the mailboxs.

mailboxes([filter])

Returns a list of mailboxes matching the filter.

messages([filter])

Returns a list of messages matching the filter.

property account: XAMailAccount

The parent account of the mailbox.

property container: XAMailbox

The parent mailbox of the mailbox.

delete()[source]

Permanently deletes the mailboxs.

New in version 0.0.4.

mailboxes(filter: dict | None = None) XAMailboxList[source]

Returns a list of mailboxes matching the filter.

New in version 0.1.0.

messages(filter: dict | None = None) XAMailMessageList[source]

Returns a list of messages matching the filter.

New in version 0.1.0.

property name: str

The name of the mailbox.

property unread_count: int

The number of unread messages in the mailbox.

class PyXA.apps.Mail.XAMailboxList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XAList

A wrapper around lists of mailboxes that employs fast enumeration techniques.

All properties of mailboxes can be called as methods on the wrapped list, returning a list containing each mailbox’s value for the property.

New in version 0.0.4.

Methods:

account()

by_account(account)

by_container(container)

by_name(name)

by_unread_count(unread_count)

container()

messages()

name()

unread_count()

account() XAMailAccountList[source]
by_account(account: XAMailAccount) XAMailbox[source]
by_container(container: XAMailContainer) XAMailbox[source]
by_name(name: str) XAMailbox[source]
by_unread_count(unread_count: int) XAMailbox[source]
container() XAMailContainerList[source]
messages()[source]
name() list[str][source]
unread_count() list[str][source]