CamelMimeMessage

## 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,
                                                             gint offset);
    time_t              camel_mime_message_get_date         (CamelMimeMessage *message,
                                                             gint *offset);
    time_t              camel_mime_message_get_date_received
                                                            (CamelMimeMessage *message,
                                                             gint *offset);
    void                camel_mime_message_set_message_id   (CamelMimeMessage *message,
                                                             const gchar *message_id);
    const gchar *       camel_mime_message_get_message_id   (CamelMimeMessage *message);
    void                camel_mime_message_set_reply_to     (CamelMimeMessage *message,
                                                             CamelInternetAddress *reply_to);
    CamelInternetAddress * camel_mime_message_get_reply_to  (CamelMimeMessage *message);
    void                camel_mime_message_set_subject      (CamelMimeMessage *message,
                                                             const gchar *subject);
    const gchar *       camel_mime_message_get_subject      (CamelMimeMessage *message);
    void                camel_mime_message_set_from         (CamelMimeMessage *message,
                                                             CamelInternetAddress *from);
    CamelInternetAddress * camel_mime_message_get_from      (CamelMimeMessage *message);
    CamelInternetAddress * camel_mime_message_get_recipients
                                                            (CamelMimeMessage *message,
                                                             const gchar *type);
    void                camel_mime_message_set_recipients   (CamelMimeMessage *message,
                                                             const gchar *type,
                                                             CamelInternetAddress *recipients);
    void                camel_mime_message_set_source       (CamelMimeMessage *message,
                                                             const gchar *source_uid);
    const gchar *       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 gchar *content_id);
    gchar *             camel_mime_message_build_mbox_from  (CamelMimeMessage *message);
    gboolean            camel_mime_message_has_attachment   (CamelMimeMessage *message);
    void                camel_mime_message_dump             (CamelMimeMessage *message,
                                                             gint body);
    gboolean            camel_mime_message_build_preview    (CamelMimePart *mime_part,
                                                             CamelMessageInfo *info);

## Object Hierarchy

      GObject
       +----CamelObject
             +----CamelDataWrapper
                   +----CamelMedium
                         +----CamelMimePart
                               +----CamelMimeMessage

## Description

## Details

### struct CamelMimeMessage

    struct CamelMimeMessage;

### 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,
                                                             gint 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,
                                                             gint *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,
                                                             gint *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 gchar *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 gchar *       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,
                                                             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 ()

    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 gchar *subject);

Set the subject text of a message.

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

### camel_mime_message_get_subject ()

    const gchar *       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,
                                                             CamelInternetAddress *from);

Set the from address of a message.

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

### camel_mime_message_get_from ()

    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 ()

    CamelInternetAddress * camel_mime_message_get_recipients
                                                            (CamelMimeMessage *message,
                                                             const gchar *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 gchar *type,
                                                             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 gchar *source_uid);

### camel_mime_message_get_source ()

    const gchar *       camel_mime_message_get_source       (CamelMimeMessage *message);

### 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 gchar *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 ()

    gchar *             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_has_attachment ()

    gboolean            camel_mime_message_has_attachment   (CamelMimeMessage *message);

`message` : | a CamelMimeMessage object
Returns : | whether message contains at least one attachment part.

Since 2.28

### camel_mime_message_dump ()

    void                camel_mime_message_dump             (CamelMimeMessage *message,
                                                             gint body);

Dump information about the mime message to stdout.

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

### camel_mime_message_build_preview ()

    gboolean            camel_mime_message_build_preview    (CamelMimePart *mime_part,
                                                             CamelMessageInfo *info);

### Note

This function blocks like crazy.

Since 2.28