## Mail Session Utilities Mail Session Utilities |

## Functions

#define | E_MAIL_ERROR
gboolean | e_mail_session_append_to_local_folder_sync ()
void | e_mail_session_append_to_local_folder ()
gboolean | e_mail_session_append_to_local_folder_finish ()
gboolean | e_mail_session_handle_draft_headers_sync ()
void | e_mail_session_handle_draft_headers ()
gboolean | e_mail_session_handle_draft_headers_finish ()
gboolean | e_mail_session_handle_source_headers_sync ()
void | e_mail_session_handle_source_headers ()
gboolean | e_mail_session_handle_source_headers_finish ()
void | e_mail_session_send_to ()
gboolean | e_mail_session_send_to_finish ()
CamelFolder * | e_mail_session_get_fcc_for_message_sync ()
void | e_mail_session_get_fcc_for_message ()
CamelFolder * | e_mail_session_get_fcc_for_message_finish ()
CamelService * | e_mail_session_ref_transport ()
CamelService * | e_mail_session_ref_default_transport ()
CamelService * | e_mail_session_ref_transport_for_message ()

## Types and Values

enum | EMailError

## Description

## Functions

### E_MAIL_ERROR

    #define E_MAIL_ERROR (e_mail_error_quark ())

### e_mail_session_append_to_local_folder_sync ()

    gboolean
    e_mail_session_append_to_local_folder_sync
                                   (EMailSession *session,
                                    EMailLocalFolder local_id,
                                    CamelMimeMessage *message,
                                    CamelMessageInfo *info,
                                    gchar **appended_uid,
                                    GCancellable *cancellable,
                                    GError **error);

### e_mail_session_append_to_local_folder ()

    void
    e_mail_session_append_to_local_folder (EMailSession *session,
                                           EMailLocalFolder local_id,
                                           CamelMimeMessage *message,
                                           CamelMessageInfo *info,
                                           gint io_priority,
                                           GCancellable *cancellable,
                                           GAsyncReadyCallback callback,
                                           gpointer user_data);

### e_mail_session_append_to_local_folder_finish ()

    gboolean
    e_mail_session_append_to_local_folder_finish
                                   (EMailSession *session,
                                    GAsyncResult *result,
                                    gchar **appended_uid,
                                    GError **error);

### e_mail_session_handle_draft_headers_sync ()

    gboolean
    e_mail_session_handle_draft_headers_sync
                                   (EMailSession *session,
                                    CamelMimeMessage *message,
                                    GCancellable *cancellable,
                                    GError **error);

### e_mail_session_handle_draft_headers ()

    void
    e_mail_session_handle_draft_headers (EMailSession *session,
                                         CamelMimeMessage *message,
                                         gint io_priority,
                                         GCancellable *cancellable,
                                         GAsyncReadyCallback callback,
                                         gpointer user_data);

### e_mail_session_handle_draft_headers_finish ()

    gboolean
    e_mail_session_handle_draft_headers_finish
                                   (EMailSession *session,
                                    GAsyncResult *result,
                                    GError **error);

### e_mail_session_handle_source_headers_sync ()

    gboolean
    e_mail_session_handle_source_headers_sync
                                   (EMailSession *session,
                                    CamelMimeMessage *message,
                                    GCancellable *cancellable,
                                    GError **error);

### e_mail_session_handle_source_headers ()

    void
    e_mail_session_handle_source_headers (EMailSession *session,
                                          CamelMimeMessage *message,
                                          gint io_priority,
                                          GCancellable *cancellable,
                                          GAsyncReadyCallback callback,
                                          gpointer user_data);

### e_mail_session_handle_source_headers_finish ()

    gboolean
    e_mail_session_handle_source_headers_finish
                                   (EMailSession *session,
                                    GAsyncResult *result,
                                    GError **error);

### e_mail_session_send_to ()

    void
    e_mail_session_send_to (EMailSession *session,
                            CamelMimeMessage *message,
                            gint io_priority,
                            GCancellable *cancellable,
                            CamelFilterGetFolderFunc get_folder_func,
                            gpointer get_folder_data,
                            GAsyncReadyCallback callback,
                            gpointer user_data);

### e_mail_session_send_to_finish ()

    gboolean
    e_mail_session_send_to_finish (EMailSession *session,
                                   GAsyncResult *result,
                                   GError **error);

### e_mail_session_get_fcc_for_message_sync ()

    CamelFolder *
    e_mail_session_get_fcc_for_message_sync
                                   (EMailSession *session,
                                    CamelMimeMessage *message,
                                    GCancellable *cancellable,
                                    GError **error);

Obtains the preferred "carbon-copy" folder (a.k.a Fcc) for `message` by first checking `message` for an "X-Evolution-Identity" header, and then an "X-Evolution-Fcc" header. Failing that, the function checks the default mail identity (if available), and failing even that, the function falls back to the Sent folder from the built-in mail store.

Where applicable, the function attempts to honor the “replies-to-origin-folder” preference.

The returned CamelFolder is referenced for thread-safety and must be unreferenced with `g_object_unref()` when finished with it.

If a non-recoverable error occurs, the function sets `error` and returns `NULL`.

#### Parameters

session | an EMailSession |
message | a CamelMimeMessage |
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

a CamelFolder, or `NULL`

### e_mail_session_get_fcc_for_message ()

    void
    e_mail_session_get_fcc_for_message (EMailSession *session,
                                        CamelMimeMessage *message,
                                        gint io_priority,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);

Asynchronously obtains the preferred "carbon-copy" folder (a.k.a Fcc) for `message` by first checking `message` for an "X-Evolution-Identity" header, and then an "X-Evolution-Fcc" header. Failing that, the function checks the default mail identity (if available), and failing even that, the function falls back to the Sent folder from the built-in mail store.

Where applicable, the function attempts to honor the “replies-to-origin-folder” preference.

When the operation is finished, `callback` will be called. You can then call `e_mail_session_get_fcc_for_message_finish()` to get the result of the operation.

#### Parameters

session | an EMailSession |
message | a CamelMimeMessage |
io_priority | the I/O priority of the request |
cancellable | optional GCancellable object, or `NULL` |
callback | a GAsyncReadyCallback to call when the request is satisfied |
user_data | data to pass to the callback function |

### e_mail_session_get_fcc_for_message_finish ()

    CamelFolder *
    e_mail_session_get_fcc_for_message_finish
                                   (EMailSession *session,
                                    GAsyncResult *result,
                                    GError **error);

Finishes the operation started with `e_mail_session_get_fcc_for_message()`.

The returned CamelFolder is referenced for thread-safety and must be unreferenced with `g_object_unref()` when finished with it.

If a non-recoverable error occurred, the function sets `error` and returns `NULL`.

#### Parameters

session | an EMailSession |
result | a GAsyncResult |
error | return location for a GError, or `NULL` |

#### Returns

a CamelFolder, or `NULL`

### e_mail_session_ref_transport ()

    CamelService *
    e_mail_session_ref_transport (EMailSession *session,
                                  const gchar *transport_uid);

Returns the transport CamelService instance for `transport_uid` , verifying first that the `transport_uid` is indeed a mail transport and that the corresponding ESource is enabled. If these checks fail, the function returns `NULL`.

The returned CamelService is referenced for thread-safety and must be unreferenced with `g_object_unref()` when finished with it.

#### Parameters

session | an EMailSession |
transport_uid | the UID of a mail transport |

#### Returns

a CamelService, or `NULL`

### e_mail_session_ref_default_transport ()

    CamelService *
    e_mail_session_ref_default_transport (EMailSession *session);

Returns the default transport CamelService instance according to ESourceRegistry's “default-mail-identity” setting, verifying first that the “transport-uid” named by the “default-mail-identity” is indeed a mail transport, and that the corresponding ESource is enabled. If these checks fail, the function returns `NULL`.

The returned CamelService is referenced for thread-safety and must be unreferenced with `g_object_unref()` when finished with it.

#### Parameters

session | an EMailSession |

#### Returns

a CamelService, or `NULL`

### e_mail_session_ref_transport_for_message ()

    CamelService *
    e_mail_session_ref_transport_for_message
                                   (EMailSession *session,
                                    CamelMimeMessage *message);

Returns the preferred transport CamelService instance for `message` by first checking `message` for an "X-Evolution-Identity" header, and then an "X-Evolution-Transport" header. Failing that, the function returns the default transport CamelService instance (if available).

The returned CamelService is referenced for thread-safety and must be unreferenced with `g_object_unref()` when finished with it.

#### Parameters

session | an EMailSession |
message | a CamelMimeMessage |

#### Returns

a CamelService, or `NULL`

## Types and Values

### enum EMailError

#### Members

E_MAIL_ERROR_POST_PROCESSING |  |