Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



The Attachment Class

An instance of the Attachment class represents an attachment to an email message, and includes attributes for specifying the filename, payload, and Content-ID for the attachment.

Attachment is provided by the google.appengine.api.mail module.

  1. Introduction
  2. Attachment()
  3. Properties :

Introduction

An Attachment object is largely interchangeable with a ( filename , payload ) tuple.

Note that the behavior is a bit asymmetric with respect to unpacking and equality comparison. An Attachment object without a content-id attribute is equivalent to a ( filename , payload ) tuple. An Attachment with a content-id unpacks to a ( filename , payload ) tuple, but compares unequally to that tuple.

Thus, the following comparison will succeed:

attachment = mail.Attachment('foo.jpg', 'data')
filename, payload = attachment
attachment == filename, payload

...while the following will fail:

attachment = mail.Attachment('foo.jpg', 'data', content_id='')
filename, payload = attachment
attachment == filename, payload

The following comparison will pass though:

attachment = mail.Attachment('foo.jpg', 'data', content_id='')
attachment == (attachment.filename,
               attachment.payload,
               attachment.content_id)

Constructor

class Attachment ( filename , payload , content_id=None )

An attachment to an email message. The fields of the Attachment object can be initialized using arguments passed to the constructor. Fields can also be set after construction using attributes of the instance.

Properties

The Attachment class provides the following properties:

filename

The name of the attachment.

payload

The name of the attachment. 7bit is the default MIME encoding.

content_id=None

Optional. The Content-ID for this attachment. The Content-ID must be enclosed in angle brackets (e.g. <my-content-id> ).

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.