Camel.MimeMessage

g Camel.DataWrapper Camel.DataWrapper Camel.Medium Camel.Medium Camel.DataWrapper->Camel.Medium Camel.MimePart Camel.MimePart Camel.Medium->Camel.MimePart Camel.MimeMessage Camel.MimeMessage Camel.MimePart->Camel.MimeMessage GObject.Object GObject.Object GObject.Object->Camel.DataWrapper

Subclasses:None

Methods

Inherited:Camel.MimePart (25), Camel.Medium (8), Camel.DataWrapper (31), GObject.Object (37)
Structs:GObject.ObjectClass (5)
class new ()
  build_mbox_from ()
  dump (body)
  encode_8bit_parts ()
  foreach_part (callback, *user_data)
  get_date ()
  get_date_received ()
  get_from ()
  get_message_id ()
  get_part_by_content_id (content_id)
  get_recipients (type)
  get_reply_to ()
  get_source ()
  get_subject ()
  has_8bit_parts ()
  has_attachment ()
  set_best_encoding (required, enctype)
  set_date (date, offset)
  set_from (from_)
  set_message_id (message_id)
  set_recipients (type, recipients)
  set_reply_to (reply_to)
  set_source (source_uid)
  set_subject (subject)

Properties

Inherited:Camel.MimePart (4), Camel.Medium (1)

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent Camel.MimePart r  

Class Details

class Camel.MimeMessage(**kwargs)
Bases:Camel.MimePart
Abstract:No
Structure:Camel.MimeMessageClass
classmethod new()
Returns:a new Camel.MimeMessage object
Return type:Camel.MimeMessage

Create a new Camel.MimeMessage object.

build_mbox_from()
Returns:an MBox from-line suitable for use in an mbox file
Return type:str

Build an MBox from-line from self.

dump(body)
Parameters:body (int) – whether to dump also message body

Dump information about the mime message to stdout.

If body is True, then dump body content of the message as well.

encode_8bit_parts()

Encode all message parts to a suitable transfer encoding for transport (7bit clean).

foreach_part(callback, *user_data)
Parameters:

Calls callback for each Camel.part of the self, including the message itself. The traverse of the self parts can be stopped when the callback returns False.

New in version 3.34.

get_date()
Returns:the date of the message
offset:output for the UTC offset
Return type:(int, offset: int)

Get the date and UTC offset of a message. See Camel.MimeMessage.set_date() for information about the offset format.

get_date_received()
Returns:the received date of the message
offset:output for the UTC offset
Return type:(int, offset: int)

Get the received date and UTC offset of a message. See Camel.MimeMessage.set_date() for information about the offset format.

get_from()
Returns:the from address of the message
Return type:Camel.InternetAddress or None

Get the from address of a message.

get_message_id()
Returns:the message-id of a message
Return type:str or None

Get the message-id of a message.

get_part_by_content_id(content_id)
Parameters:content_id (str) – content-id to search for
Returns:the MIME Camel.part with the requested id, or None if not found
Return type:Camel.MimePart or None

Get a MIME Camel.part by id from a message.

get_recipients(type)
Parameters:type (str) – recipient type
Returns:the requested recipients
Return type:Camel.InternetAddress or None

Get the message recipients of a specified type.

get_reply_to()
Returns:the Reply-To address of the message
Return type:Camel.InternetAddress or None

Get the Reply-To of a message.

get_source()
Returns:the uid of the source account
Return type:str or None

Get the UID of the source account of the message.

get_subject()
Returns:the message subject
Return type:str or None

Get the UTF-8 subject text of a message.

has_8bit_parts()
Returns:True if the message contains 8bit parts or False otherwise
Return type:bool

Find out if a message contains 8bit or binary encoded parts.

has_attachment()
Return type:bool

Returns whether message contains at least one attachment Camel.part.

New in version 2.28.

set_best_encoding(required, enctype)
Parameters:

Re-encode all message parts to conform with the required encoding rules.

If enctype is Camel.BestencEncoding._7BIT, then all parts will be re-encoded into one of the 7bit transfer encodings. If enctype is Camel.BestencEncoding._8BIT, all parts will be re-encoded to either a 7bit encoding or, if the Camel.part is 8bit text, allowed to stay 8bit. If enctype is Camel.BestencEncoding.BINARY, then binary parts will be encoded as binary and 8bit textual parts will be encoded as 8bit.

set_date(date, offset)
Parameters:
  • date (int) – a time_t date or Camel.MESSAGE_DATE_CURRENT to use the current local date and time
  • offset (int) – an offset from UTC in decimal number using the +HHMM format (for instance an offset of -10:45 is -1045). If date set to Camel.MESSAGE_DATE_CURRENT, this parameter is ignored

Set the date on a message.

In most cases, this is used to set the current date:

camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0);

set_from(from_)
Parameters:from (Camel.InternetAddress or None) – a Camel.InternetAddress object

Set the from address of a message.

set_message_id(message_id)
Parameters:message_id (str or None) – id of the message, or None to generate a new one using the from address

Set the message-id on a message.

set_recipients(type, recipients)
Parameters:

Set the recipients of a message.

set_reply_to(reply_to)
Parameters:reply_to (Camel.InternetAddress or None) – a Camel.InternetAddress object

Set the Reply-To of a message.

set_source(source_uid)
Parameters:source_uid (str or None) – the uid of the source account

Set the UID of the source account of the message.

set_subject(subject)
Parameters:subject (str or None) – UTF-8 message subject

Set the subject text of a message.