App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
google.appengine.api.mail._EmailMessageBase Class Reference
Inheritance diagram for google.appengine.api.mail._EmailMessageBase:
google.appengine.api.mail.AdminEmailMessage google.appengine.api.mail.EmailMessage google.appengine.api.mail.InboundEmailMessage

Public Member Functions

def __init__
 
def original
 
def initialize
 
def Initialize
 
def check_initialized
 
def CheckInitialized
 
def is_initialized
 
def IsInitialized
 
def ToProto
 
def to_mime_message
 
def ToMIMEMessage
 
def send
 
def Send
 
def __setattr__
 
def update_from_mime_message
 
def bodies
 

Public Attributes

 body
 
 html
 
 attachments
 
 sender
 
 reply_to
 
 subject
 

Static Public Attributes

tuple PROPERTIES
 
tuple ALLOWED_EMPTY_PROPERTIES
 

Detailed Description

Base class for email API service objects.

Subclasses must define a class variable called _API_CALL with the name
of its underlying mail sending API call.

Constructor & Destructor Documentation

def google.appengine.api.mail._EmailMessageBase.__init__ (   self,
  mime_message = None,
  kw 
)
Initialize Email message.

Creates new MailMessage protocol buffer and initializes it with any
keyword arguments.

Args:
  mime_message: MIME message to initialize from.  If instance of
email.Message.Message will take ownership as original message.
  kw: List of keyword properties as defined by PROPERTIES.

Member Function Documentation

def google.appengine.api.mail._EmailMessageBase.__setattr__ (   self,
  attr,
  value 
)
Property setting access control.

Controls write access to email fields.

Args:
  attr: Attribute to access.
  value: New value for field.

Raises:
  ValueError: If provided with an empty field.
  AttributeError: If not an allowed assignment field.
def google.appengine.api.mail._EmailMessageBase.bodies (   self,
  content_type = None 
)
Iterate over all bodies.

Yields:
  Tuple (content_type, payload) for html and body in that order.
def google.appengine.api.mail._EmailMessageBase.check_initialized (   self)
Check if EmailMessage is properly initialized.

Test used to determine if EmailMessage meets basic requirements
for being used with the mail API.  This means that the following
fields must be set or have at least one value in the case of
multi value fields:

  - Subject must be set.
  - A recipient must be specified.
  - Must contain a body.
  - All bodies and attachments must decode properly.

This check does not include determining if the sender is actually
authorized to send email for the application.

Raises:
  Appropriate exception for initialization failure.

InvalidAttachmentTypeError: Use of incorrect attachment type.
MissingRecipientsError:     No recipients specified in to, cc or bcc.
MissingSenderError:         No sender specified.
MissingSubjectError:        Subject is not specified.
MissingBodyError:           No body specified.
PayloadEncodingError:       Payload is not properly encoded.
UnknownEncodingError:       Payload has unknown encoding.
UnknownCharsetError:        Payload has unknown character set.
def google.appengine.api.mail._EmailMessageBase.initialize (   self,
  kw 
)
Keyword initialization.

Used to set all fields of the email message using keyword arguments.

Args:
  kw: List of keyword properties as defined by PROPERTIES.
def google.appengine.api.mail._EmailMessageBase.is_initialized (   self)
Determine if EmailMessage is properly initialized.

Returns:
  True if message is properly initializes, otherwise False.
def google.appengine.api.mail._EmailMessageBase.original (   self)
Get original MIME message from which values were set.
def google.appengine.api.mail._EmailMessageBase.send (   self,
  make_sync_call = apiproxy_stub_map.MakeSyncCall 
)
Send email message.

Send properly initialized email message via email API.

Args:
  make_sync_call: Method which will make synchronous call to api proxy.

Raises:
  Errors defined in this file above.
def google.appengine.api.mail._EmailMessageBase.to_mime_message (   self)
Generate a MIMEMultitype message from EmailMessage.

Calls MailMessageToMessage after converting self to protocol
buffer.  Protocol buffer is better at handing corner cases
than EmailMessage class.

Returns:
  MIMEMultitype representing the provided MailMessage.

Raises:
  Appropriate exception for initialization failure.

  InvalidAttachmentTypeError: Use of incorrect attachment type.
  MissingSenderError:         No sender specified.
  MissingSubjectError:        Subject is not specified.
  MissingBodyError:           No body specified.
def google.appengine.api.mail._EmailMessageBase.ToProto (   self)
Convert mail message to protocol message.

Unicode strings are converted to UTF-8 for all fields.

This method is overriden by EmailMessage to support the sender fields.

Returns:
  MailMessage protocol version of mail message.

Raises:
  Passes through decoding errors that occur when using when decoding
  EncodedPayload objects.
def google.appengine.api.mail._EmailMessageBase.update_from_mime_message (   self,
  mime_message 
)
Copy information from a mime message.

Set information of instance to values of mime message.  This method
will only copy values that it finds.  Any missing values will not
be copied, nor will they overwrite old values with blank values.

This object is not guaranteed to be initialized after this call.

Args:
  mime_message: email.Message instance to copy information from.

Returns:
  MIME Message instance of mime_message argument.

Member Data Documentation

tuple google.appengine.api.mail._EmailMessageBase.ALLOWED_EMPTY_PROPERTIES
static
Initial value:
1 = set([
2  'subject',
3  'body'
4  ])
tuple google.appengine.api.mail._EmailMessageBase.PROPERTIES
static
Initial value:
1 = set([
2  'sender',
3  'reply_to',
4  'subject',
5  'body',
6  'html',
7  'attachments',
8  ])

The documentation for this class was generated from the following file: