## CamelMimeMessage CamelMimeMessage |

## Functions

CamelMimeMessage * | camel_mime_message_new ()
void | camel_mime_message_set_date ()
time_t | camel_mime_message_get_date ()
time_t | camel_mime_message_get_date_received ()
void | camel_mime_message_set_message_id ()
const gchar * | camel_mime_message_get_message_id ()
void | camel_mime_message_set_reply_to ()
CamelInternetAddress * | camel_mime_message_get_reply_to ()
void | camel_mime_message_set_subject ()
const gchar * | camel_mime_message_get_subject ()
void | camel_mime_message_set_from ()
CamelInternetAddress * | camel_mime_message_get_from ()
CamelInternetAddress * | camel_mime_message_get_recipients ()
void | camel_mime_message_set_recipients ()
void | camel_mime_message_set_source ()
const gchar * | camel_mime_message_get_source ()
gboolean | (*CamelForeachPartFunc) ()
void | camel_mime_message_foreach_part ()
gboolean | camel_mime_message_has_8bit_parts ()
void | camel_mime_message_set_best_encoding ()
void | camel_mime_message_encode_8bit_parts ()
CamelMimePart * | camel_mime_message_get_part_by_content_id ()
gchar * | camel_mime_message_build_mbox_from ()
gboolean | camel_mime_message_has_attachment ()
void | camel_mime_message_dump ()

## Types and Values

#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

## Object Hierarchy

        GObject
        ╰── CamelDataWrapper
            ╰── CamelMedium
                ╰── CamelMimePart
                    ╰── CamelMimeMessage

## Description

## Functions

### 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.

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

    1
    camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0);

#### Parameters

message | a CamelMimeMessage object |
date | a time_t date or `CAMEL_MESSAGE_DATE_CURRENT` to use the current local date and time |
offset | 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 |

### camel_mime_message_get_date ()

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

Get the date and UTC offset of a message. See `camel_mime_message_set_date()` for information about the `offset` format.

#### Parameters

message | a CamelMimeMessage object |
offset | output for the UTC offset. | [out]

#### 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 UTC offset of a message. See `camel_mime_message_set_date()` for information about the `offset` format.

#### Parameters

message | a CamelMimeMessage object |
offset | output for the UTC offset. | [out]

#### 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.

#### Parameters

message | a CamelMimeMessage object |
message_id | id of the message, or `NULL` to generate a new one using the from address. | [nullable]

### camel_mime_message_get_message_id ()

    const gchar *
    camel_mime_message_get_message_id (CamelMimeMessage *message);

Get the message-id of a message.

#### Parameters

message | a CamelMimeMessage object |

#### Returns

the message-id of a message.

[nullable]

### 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.

#### Parameters

message | a CamelMimeMessage object |
reply_to | a CamelInternetAddress object. | [nullable]

### camel_mime_message_get_reply_to ()

    CamelInternetAddress *
    camel_mime_message_get_reply_to (CamelMimeMessage *message);

Get the Reply-To of a message.

#### Parameters

message | a CamelMimeMessage object |

#### Returns

the Reply-To address of the message.

[transfer none][nullable]

### camel_mime_message_set_subject ()

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

Set the subject text of a message.

#### Parameters

message | a CamelMimeMessage object |
subject | UTF-8 message subject. | [nullable]

### camel_mime_message_get_subject ()

    const gchar *
    camel_mime_message_get_subject (CamelMimeMessage *message);

Get the UTF-8 subject text of a message.

#### Parameters

message | a CamelMimeMessage object |

#### Returns

the message subject.

[nullable]

### camel_mime_message_set_from ()

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

Set the from address of a message.

#### Parameters

message | a CamelMimeMessage object |
from | a CamelInternetAddress object. | [nullable]

### camel_mime_message_get_from ()

    CamelInternetAddress *
    camel_mime_message_get_from (CamelMimeMessage *message);

Get the from address of a message.

#### Parameters

message | a CamelMimeMessage object |

#### Returns

the from address of the message.

[transfer none][nullable]

### camel_mime_message_get_recipients ()

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

Get the message recipients of a specified type.

#### Parameters

message | a CamelMimeMessage object |
type | recipient type |

#### Returns

the requested recipients.

[transfer none][nullable]

### camel_mime_message_set_recipients ()

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

Set the recipients of a message.

#### Parameters

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 or `NULL` to remove the already defined one. | [nullable]

### camel_mime_message_set_source ()

    void
    camel_mime_message_set_source (CamelMimeMessage *message,
                                   const gchar *source_uid);

Set the UID of the source account of the message.

#### Parameters

message | a CamelMimeMessage object |
source_uid | the uid of the source account. | [nullable]

### camel_mime_message_get_source ()

    const gchar *
    camel_mime_message_get_source (CamelMimeMessage *message);

Get the UID of the source account of the message.

#### Parameters

message | a CamelMimeMessage object |

#### Returns

the uid of the source account.

[nullable]

### CamelForeachPartFunc ()

    gboolean
    (*CamelForeachPartFunc) (CamelMimeMessage *message,
                             CamelMimePart *part,
                             CamelMimePart *parent_part,
                             gpointer user_data);

Callback used to traverse parts of the `message` using `camel_mime_message_foreach_part()`.

#### Parameters

message | a CamelMimeMessage |
part | a CamelMimePart, for which the function is called |
parent_part | a CamelMimePart, parent of the `part` ; can be `NULL`. | [nullable]
user_data | user data, as passed to `camel_mime_message_foreach_part()` |

#### Returns

`TRUE`, when the traverse should continue, `FALSE` to stop traversing parts of the `message`

Since: 3.34

### camel_mime_message_foreach_part ()

    void
    camel_mime_message_foreach_part (CamelMimeMessage *message,
                                     CamelForeachPartFunc callback,
                                     gpointer user_data);

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

#### Parameters

message | a CamelMimeMessage |
callback | a CamelForeachPartFunc callback to call for each part. | [scope call]
user_data | user data passed to the `callback` . | [closure callback]

Since: 3.34

### 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.

#### Parameters

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.

#### Parameters

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

#### Parameters

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.

#### Parameters

message | a CamelMimeMessage object |
content_id | content-id to search for |

#### Returns

the MIME part with the requested id, or `NULL` if not found.

[transfer none][nullable]

### camel_mime_message_build_mbox_from ()

    gchar *
    camel_mime_message_build_mbox_from (CamelMimeMessage *message);

Build an MBox from-line from `message` .

#### Parameters

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

Returns whether message contains at least one attachment part.

#### Parameters

message | a CamelMimeMessage object |

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.

#### Parameters

message | a CamelMimeMessage |
body | whether to dump also message body |

## Types and Values

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