Live Chat

We'll need to share your messages (and your email address if you're logged in) with our live chat provider, Drift. Here's their privacy policy.

If you don't want to do this, you can email us instead at contact@anvil.works.

anvil.email Module

The anvil.email module contains functions for sending and receiving email in your Anvil app.

Classes

Address

Create a new ‘Address’ object


Address Attributes

address - string

The email address this object represents.

name - string

The name associated with the address this object represents.

raw_value - string

The full string value of this address.


DeliveryFailure

Create a new ‘DeliveryFailure’ object

Constructor

DeliveryFailure()

Message

Create a new ‘Message’ object


Instance Methods

get_header(header_name, [default=None])

Return the value of the specified header, or default value if it is not present.

Case-insensitive. If the header is specified multiple times, returns the first value.

list_header(header_name)

Return a list containing every value of the specified header. Case-insensitive.

reply([cc=], [bcc=], [from_address=], [from_name=], [text=], [html=], [attachments=])

Reply to this email.


Message Attributes

addressees - anvil.email.Message.Addressees instance

The addresses this email was sent from and to, according to the headers.

attachments - list(anvil.Media instance)

A list of this email’s attachments.

dkim - anvil.email.Message.DKIM instance

Object describing whether this message was signed by the sending domain

envelope - anvil.email.Message.Envelope instance

The sender and receipient of this email, according to the SMTP envelope.

headers - list

All the headers in this email, as a list of (name,value) pairs.

html - string

The HTML content of this email, or None if there is no HTML part.

inline_attachments - dict(string,anvil.Media instance)

A dictionary of this email’s inline attachments. Keys are ContentID headers, values are the attachments as Media Objects.

subject - string

The subject of this email, or None if there is no subject.

text - string

The plain-text content of this email, or None if there is no plain-text part.


SendFailure

Create a new ‘SendFailure’ object

Constructor

SendFailure()

SendReport

Create a new ‘SendReport’ object


SendReport Attributes

message_id - string

The Message-ID header given to this outgoing message.


Functions

send([to=], [cc=], [bcc=], [from_address="no-reply"], [from_name=], [subject=], [text=], [html=], [attachments=], [inline_attachments=]) → anvil.email.SendReport instance

Send an email



anvil.email