Attachment

An attachment is bytes with a filename and a content type that a message carries.

Usage

Source

Attachment(
    filename,
    content_type,
    data,
    content_id,
)

Message.attach() and Message.embed() build one. See ADR-0018.

Attributes

filename: str

The name the recipient sees.

content_type: str

A bare media type, with no parameters. Within a message it is never a message/* or multipart/* type, so a transport can write the bytes as base64.

data: bytes

The bytes, which the builder method reads at call time.

content_id: str | None
The name the HTML uses after cid: on an inline image, or None on an attachment.