## CamelMimeMessage CamelMimeMessage |

## Synopsis

    struct              CamelMimeMessage;
    #define             CAMEL_RECIPIENT_TYPE_TO
    #define             CAMEL_RECIPIENT_TYPE_CC
    #define             CAMEL_RECIPIENT_TYPE_BCC
    #define             CAMEL_RECIPIENT_TYPE_RESENT_TO
    #define             CAMEL_RECIPIENT_TYPE_RESENT_CC
    #define             CAMEL_RECIPIENT_TYPE_RESENT_BCC
    #define             CAMEL_MESSAGE_DATE_CURRENT
    CamelMimeMessage *  camel_mime_message_new              (void);
    void                camel_mime_message_set_date         (CamelMimeMessage *message,
                                                             time_t date,
                                                             int offset);
    time_t              camel_mime_message_get_date         (CamelMimeMessage *message,
                                                             int *offset);
    time_t              camel_mime_message_get_date_received
                                                            (CamelMimeMessage *message,
                                                             int *offset);
    void                camel_mime_message_set_message_id   (CamelMimeMessage *message,
                                                             const char *message_id);
    const char *        camel_mime_message_get_message_id   (CamelMimeMessage *message);
    void                camel_mime_message_set_reply_to     (CamelMimeMessage *message,
                                                             const CamelInternetAddress *reply_to);
    const CamelInternetAddress * camel_mime_message_get_reply_to
                                                            (CamelMimeMessage *message);
    void                camel_mime_message_set_subject      (CamelMimeMessage *message,
                                                             const char *subject);
    const char *        camel_mime_message_get_subject      (CamelMimeMessage *message);
    void                camel_mime_message_set_from         (CamelMimeMessage *message,
                                                             const CamelInternetAddress *from);
    const CamelInternetAddress * camel_mime_message_get_from
                                                            (CamelMimeMessage *message);
    const CamelInternetAddress * camel_mime_message_get_recipients
                                                            (CamelMimeMessage *message,
                                                             const char *type);
    void                camel_mime_message_set_recipients   (CamelMimeMessage *message,
                                                             const char *type,
                                                             const CamelInternetAddress *recipients);
    void                camel_mime_message_set_source       (CamelMimeMessage *message,
                                                             const char *identity);
    const char *        camel_mime_message_get_source       (CamelMimeMessage *message);
    gboolean            camel_mime_message_has_8bit_parts   (CamelMimeMessage *message);
    void                camel_mime_message_set_best_encoding
                                                            (CamelMimeMessage *message,
                                                             CamelBestencRequired required,
                                                             CamelBestencEncoding enctype);
    void                camel_mime_message_encode_8bit_parts
                                                            (CamelMimeMessage *message);
    CamelMimePart *     camel_mime_message_get_part_by_content_id
                                                            (CamelMimeMessage *message,
                                                             const char *content_id);
    char *              camel_mime_message_build_mbox_from  (CamelMimeMessage *message);
    void                camel_mime_message_dump             (CamelMimeMessage *msg,
                                                             int body);

## Description

## Details

### struct CamelMimeMessage

    struct CamelMimeMessage {
    	CamelMimePart parent_object;

    	/* header fields */
    	time_t date;
    	int date_offset;	/* GMT offset */

    	/* cached internal copy */
    	time_t date_received;
    	int date_received_offset;	/* GMT offset */

    	char *subject;

    	char *message_id;

    	CamelInternetAddress *reply_to;
    	CamelInternetAddress *from;

    	GHashTable *recipients;	/* hash table of CamelInternetAddress's */
    };

### CAMEL_RECIPIENT_TYPE_TO

    #define CAMEL_RECIPIENT_TYPE_TO "To"

### CAMEL_RECIPIENT_TYPE_CC

    #define CAMEL_RECIPIENT_TYPE_CC "Cc"

### CAMEL_RECIPIENT_TYPE_BCC

    #define CAMEL_RECIPIENT_TYPE_BCC "Bcc"

### CAMEL_RECIPIENT_TYPE_RESENT_TO

    #define CAMEL_RECIPIENT_TYPE_RESENT_TO "Resent-To"

### CAMEL_RECIPIENT_TYPE_RESENT_CC

    #define CAMEL_RECIPIENT_TYPE_RESENT_CC "Resent-Cc"

### CAMEL_RECIPIENT_TYPE_RESENT_BCC

    #define CAMEL_RECIPIENT_TYPE_RESENT_BCC "Resent-Bcc"

### CAMEL_MESSAGE_DATE_CURRENT

    #define CAMEL_MESSAGE_DATE_CURRENT (~0)

### camel_mime_message_new ()

    CamelMimeMessage *  camel_mime_message_new              (void);

Create a new CamelMimeMessage object.

Returns : | a new CamelMimeMessage object

### camel_mime_message_set_date ()

    void                camel_mime_message_set_date         (CamelMimeMessage *message,
                                                             time_t date,
                                                             int offset);

Set the date on a message.

`message` : | a CamelMimeMessage object
`date` : | a time_t date
`offset` : | an offset from GMT

### camel_mime_message_get_date ()

    time_t              camel_mime_message_get_date         (CamelMimeMessage *message,
                                                             int *offset);

Get the date and GMT offset of a message.

`message` : | a CamelMimeMessage object
`offset` : | output for the GMT offset
Returns : | the date of the message

### camel_mime_message_get_date_received ()

    time_t              camel_mime_message_get_date_received
                                                            (CamelMimeMessage *message,
                                                             int *offset);

Get the received date and GMT offset of a message.

`message` : | a CamelMimeMessage object
`offset` : | output for the GMT offset
Returns : | the received date of the message

### camel_mime_message_set_message_id ()

    void                camel_mime_message_set_message_id   (CamelMimeMessage *message,
                                                             const char *message_id);

Set the message-id on a message.

`message` : | a CamelMimeMessage object
`message_id` : | id of the message

### camel_mime_message_get_message_id ()

    const char *        camel_mime_message_get_message_id   (CamelMimeMessage *message);

Get the message-id of a message.

`message` : | a CamelMimeMessage object
Returns : | the message-id of a message

### camel_mime_message_set_reply_to ()

    void                camel_mime_message_set_reply_to     (CamelMimeMessage *message,
                                                             const CamelInternetAddress *reply_to);

Set the Reply-To of a message.

`message` : | a CamelMimeMessage object
`reply_to` : | a CamelInternetAddress object

### camel_mime_message_get_reply_to ()

    const CamelInternetAddress * camel_mime_message_get_reply_to
                                                            (CamelMimeMessage *message);

Get the Reply-To of a message.

`message` : | a CamelMimeMessage object
Returns : | the Reply-Toa ddress of the message

### camel_mime_message_set_subject ()

    void                camel_mime_message_set_subject      (CamelMimeMessage *message,
                                                             const char *subject);

Set the subject text of a message.

`message` : | a CamelMimeMessage object
`subject` : | UTF-8 message subject

### camel_mime_message_get_subject ()

    const char *        camel_mime_message_get_subject      (CamelMimeMessage *message);

Get the UTF-8 subject text of a message.

`message` : | a CamelMimeMessage object
Returns : | the message subject

### camel_mime_message_set_from ()

    void                camel_mime_message_set_from         (CamelMimeMessage *message,
                                                             const CamelInternetAddress *from);

Set the from address of a message.

`message` : | a CamelMimeMessage object
`from` : | a CamelInternetAddress object

### camel_mime_message_get_from ()

    const CamelInternetAddress * camel_mime_message_get_from
                                                            (CamelMimeMessage *message);

Get the from address of a message.

`message` : | a CamelMimeMessage object
Returns : | the from address of the message

### camel_mime_message_get_recipients ()

    const CamelInternetAddress * camel_mime_message_get_recipients
                                                            (CamelMimeMessage *message,
                                                             const char *type);

Get the message recipients of a specified type.

`message` : | a CamelMimeMessage object
`type` : | recipient type
Returns : | the requested recipients

### camel_mime_message_set_recipients ()

    void                camel_mime_message_set_recipients   (CamelMimeMessage *message,
                                                             const char *type,
                                                             const CamelInternetAddress *recipients);

Set the recipients of a message.

`message` : | a CamelMimeMessage object
`type` : | recipient type (one of CAMEL_RECIPIENT_TYPE_TO, CAMEL_RECIPIENT_TYPE_CC, or CAMEL_RECIPIENT_TYPE_BCC)
`recipients` : | a CamelInternetAddress with the recipient addresses set

### camel_mime_message_set_source ()

    void                camel_mime_message_set_source       (CamelMimeMessage *message,
                                                             const char *identity);

`message` : |
`identity` : |

### camel_mime_message_get_source ()

    const char *        camel_mime_message_get_source       (CamelMimeMessage *message);

`message` : |
Returns : |

### camel_mime_message_has_8bit_parts ()

    gboolean            camel_mime_message_has_8bit_parts   (CamelMimeMessage *message);

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

`message` : | a CamelMimeMessage object
Returns : | `TRUE` if the message contains 8bit parts or `FALSE` otherwise

### camel_mime_message_set_best_encoding ()

    void                camel_mime_message_set_best_encoding
                                                            (CamelMimeMessage *message,
                                                             CamelBestencRequired required,
                                                             CamelBestencEncoding enctype);

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

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

`message` : | a CamelMimeMessage object
`required` : | a bitwise ORing of CAMEL_BESTENC_GET_ENCODING and CAMEL_BESTENC_GET_CHARSET
`enctype` : | an encoding to enforce

### camel_mime_message_encode_8bit_parts ()

    void                camel_mime_message_encode_8bit_parts
                                                            (CamelMimeMessage *message);

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

`message` : | a CamelMimeMessage object

### camel_mime_message_get_part_by_content_id ()

    CamelMimePart *     camel_mime_message_get_part_by_content_id
                                                            (CamelMimeMessage *message,
                                                             const char *content_id);

Get a MIME part by id from a message.

`message` : | a CamelMimeMessage object
`content_id` : | content-id to search for
Returns : | the MIME part with the requested id or `NULL` if not found

### camel_mime_message_build_mbox_from ()

    char *              camel_mime_message_build_mbox_from  (CamelMimeMessage *message);

Build an MBox from-line from `message`.

`message` : | a CamelMimeMessage object
Returns : | an MBox from-line suitable for use in an mbox file

### camel_mime_message_dump ()

    void                camel_mime_message_dump             (CamelMimeMessage *msg,
                                                             int body);

Dump information about the mime message to stdout.

If body is TRUE, then dump body content of the message as well (currently unimplemented).

`msg` : |
`body` : |