core.constants module

Module with the constant values for the core app.

class core.constants.EmailFetchingCriterionChoices(*values)[source]

Bases: TextChoices

Namespace class for all implemented mail fetching criteria constants.

For a list of all existing IMAP criteria see https://datatracker.ietf.org/doc/html/rfc3501.html#section-6.4.4 Note that IMAP does not support time just dates. So we are always referring to full days.

DAILY = 'DAILY'

Filter using “SENTSINCE” for mails sent the previous day.

WEEKLY = 'WEEKLY'

Filter using “SENTSINCE” for mails sent the previous week.

MONTHLY = 'MONTHLY'

Filter using “SENTSINCE” for mails sent the previous 4 weeks.

ANNUALLY = 'ANNUALLY'

Filter using “SENTSINCE” for mails sent the previous 52 weeks.

RECENT = 'RECENT'

Filter by “RECENT” flag.

UNSEEN = 'UNSEEN'

Filter by “UNSEEN” flag.

SEEN = 'SEEN'

Filter by “SEEN” flag.

ALL = 'ALL'

Filter by “ALL” flag.

NEW = 'NEW'

Filter by “NEW” flag.

OLD = 'OLD'

Filter by “OLD” flag.

FLAGGED = 'FLAGGED'

Filter by “FLAGGED” flag.

UNFLAGGED = 'UNFLAGGED'

Filter by “UNFLAGGED” flag.

DRAFT = 'DRAFT'

Filter by “DRAFT” flag.

UNDRAFT = 'UNDRAFT'

Filter by “UNDRAFT” flag.

ANSWERED = 'ANSWERED'

Filter by “ANSWERED” flag.

UNANSWERED = 'UNANSWERED'

Filter by “UNANSWERED” flag.

DELETED = 'DELETED'

Filter by “DELETED” flag.

UNDELETED = 'UNDELETED'

Filter by “UNDELETED” flag.

KEYWORD = 'KEYWORD {}'

Filter by “KEYWORD”. Must be formatted.

UNKEYWORD = 'UNKEYWORD {}'

Filter by “UNKEYWORD”. Must be formatted.

LARGER = 'LARGER {}'

Filter by “LARGER”. Must be formatted.

SMALLER = 'SMALLER {}'

Filter by “SMALLER”. Must be formatted.

SUBJECT = 'SUBJECT {}'

Filter by “SUBJECT” content. Must be formatted.

BODY = 'BODY {}'

Filter by “BODY” content. Must be formatted.

FROM = 'FROM {}'

Filter by “FROM” header. Must be formatted.

SENTSINCE = 'SENTSINCE {}'

Filter by “SENTSINCE” time. Must be formatted.

static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the list of values assigned

__str__()

Return str(self).

class core.constants.EmailProtocolChoices(*values)[source]

Bases: TextChoices

Namespace class for all implemented mail protocols constants.

IMAP4_SSL = 'IMAP4_SSL'

The IMAP4 protocol over SSL

IMAP4 = 'IMAP'

The IMAP4 protocol

POP3_SSL = 'POP3_SSL'

The POP3 protocol over SSL

POP3 = 'POP3'

The POP3 protocol

EXCHANGE = 'EXCHANGE'

Microsoft’s Exchange protocol

JMAP = 'JMAP'

The JMAP protocol

static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the list of values assigned

__str__()

Return str(self).

class core.constants.MailboxTypeChoices(*values)[source]

Bases: TextChoices

Namespace class for all available mailbox types.

INBOX = 'INBOX'
OUTBOX = 'OUTBOX'
SENT = 'SENT'
JUNK = 'JUNK'
DRAFTS = 'DRAFTS'
TRASH = 'TRASH'
CUSTOM = ''

Custom mailboxes have no type.

static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the list of values assigned

__str__()

Return str(self).

class core.constants.HeaderFields[source]

Bases: object

Namespace class with all header fields that have their own column in the emails table.

For existing header fields see https://www.iana.org/assignments/message-headers/message-headers.xhtml.

All header field names are lowercase and the lookups case-insensitive to avoid issues with different spellings.

MESSAGE_ID: Final[str] = 'message-id'
IN_REPLY_TO: Final[str] = 'in-reply-to'
REFERENCES: Final[str] = 'references'
DATE: Final[str] = 'date'
SUBJECT: Final[str] = 'subject'
X_SPAM: Final[str] = 'x-spam-flag'
CONTENT_ID: Final[str] = 'content-id'
class MailingList[source]

Bases: object

Headers that are included in the mailinglists table.

ID: Final[str] = 'list-id'
OWNER: Final[str] = 'list-owner'
SUBSCRIBE: Final[str] = 'list-subscribe'
UNSUBSCRIBE: Final[str] = 'list-unsubscribe'
UNSUBSCRIBE_POST: Final[str] = 'list-unsubscribe-post'
POST: Final[str] = 'list-post'
HELP: Final[str] = 'list-help'
ARCHIVE: Final[str] = 'list-archive'
class Correspondents(*values)[source]

Bases: TextChoices

Headers that are treated as correspondents.

This class holds the choices for core.models.EmailCorrespondents.

FROM = 'from'
TO = 'to'
CC = 'cc'
BCC = 'bcc'
SENDER = 'sender'
REPLY_TO = 'reply-To'
RESENT_FROM = 'resent-from'
RESENT_TO = 'resent-to'
RESENT_CC = 'resent-cc'
RESENT_BCC = 'resent-bcc'
static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the list of values assigned

__str__()

Return str(self).

RESENT_SENDER = 'resent-sender'
RESENT_REPLY_TO = 'resent-reply-to'
ENVELOPE_TO = 'envelope-to'
DELIVERED_TO = 'delivered-to'
RETURN_PATH = 'return-path'
RETURN_RECEIPT_TO = 'return-receipt-to'
DISPOSITION_NOTIFICATION_TO = 'disposition-notification-to'
class core.constants.SupportedEmailDownloadFormats(*values)[source]

Bases: TextChoices

All fileformats that are available for download of emaildata.

The file extension is taken from the value as value.split(“[]”).

static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the list of values assigned

__str__()

Return str(self).

ZIP_EML = 'zip[eml]'
MBOX = 'mbox'
BABYL = 'babyl'
MMDF = 'mmdf'
MH = 'zip[mh]'
MAILDIR = 'zip[maildir]'
class core.constants.SupportedEmailUploadFormats(*values)[source]

Bases: TextChoices

All fileformats that are supported for upload of emaildata.

static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the list of values assigned

__str__()

Return str(self).

EML = 'eml'
ZIP_EML = 'zip[eml]'
MBOX = 'mbox'
BABYL = 'babyl'
MMDF = 'mmdf'
MH = 'zip[mh]'
MAILDIR = 'zip[maildir]'
core.constants.PROTOCOLS_SUPPORTING_RESTORE = (EmailProtocolChoices.IMAP4, EmailProtocolChoices.IMAP4_SSL, EmailProtocolChoices.EXCHANGE, EmailProtocolChoices.JMAP)

All protocols supporting restoring of emails.

core.constants.HTML_SUPPORTED_AUDIO_TYPE = ('ogg', 'wav', 'mpeg', 'aac')

All audio types supported by html elements.

core.constants.HTML_SUPPORTED_VIDEO_TYPES = ('ogg', 'mp4', 'mpeg', 'webm', 'avi')

All video types supported by html elements.

core.constants.PAPERLESS_SUPPORTED_IMAGE_TYPES = ('png', 'jpeg', 'pjpeg', 'tiff', 'x-tiff', 'gif', 'webp')

All image types supported by Paperless.

core.constants.PAPERLESS_TIKA_SUPPORTED_MIMETYPES = ('msword', 'vnd.openxmlformats-officedocument.wordprocessingml.document', 'vnd.oasis.opendocument.text', 'powerpoint', 'mspowerpoint', 'vnd.ms-powerpoint', 'vnd.openxmlformats-officedocument.presentationml.presentation', 'vnd.oasis.opendocument.presentation', 'excel', 'msexcel', 'x-excel', 'x-msexcel', 'vnd.ms-excel', 'vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'vnd.oasis.opendocument.spreadsheet')

All application types supported by Paperless Tika.

core.constants.IMMICH_SUPPORTED_APPLICATION_TYPES = ('photoshop', 'x-matroska', 'mp4')

All application types supported by Immich.

core.constants.IMMICH_SUPPORTED_IMAGE_TYPES = ('avif', 'bmp', 'x-bmp', 'x-ms-bmp', 'gif', 'heic', 'heif', 'jp2', 'jpeg', 'pjpeg', 'jxl', 'png', 'vnd.adobe.photoshop', 'x-psd', 'raw', 'x-raw-panasonic', 'x-panasonic-raw', 'x-panasonic-raw2', 'x-panasonic-rw', 'x-panasonic-rw2', 'svg+xml', 'tiff', 'x-tiff', 'webp')

All image types supported by Immich.

core.constants.IMMICH_SUPPORTED_VIDEO_TYPES = ('3gpp', 'x-msvideo', 'x-flv', 'x-m4v', 'matroska', 'x-matroska', 'matroska-3d', 'mp2t', 'mp4', 'mpeg', 'quicktime', 'webm', 'x-ms-wmv')

All video types supported by Immich.

core.constants.file_format_parsers: Final[dict[str, type[mbox | Babyl | MMDF | Maildir | MH]]] = {SupportedEmailUploadFormats.BABYL: <class 'mailbox.Babyl'>, SupportedEmailUploadFormats.MBOX: <class 'mailbox.mbox'>, SupportedEmailUploadFormats.MMDF: <class 'mailbox.MMDF'>, SupportedEmailUploadFormats.MAILDIR: <class 'mailbox.Maildir'>, SupportedEmailUploadFormats.MH: <class 'mailbox.MH'>}

Mapping of supported file formats to their parser classes.