## EMailSession EMailSession |

## Functions

EMailSession * | e_mail_session_new ()
ESourceRegistry * | e_mail_session_get_registry ()
MailFolderCache * | e_mail_session_get_folder_cache ()
CamelStore * | e_mail_session_get_local_store ()
CamelStore * | e_mail_session_get_vfolder_store ()
CamelFolder * | e_mail_session_get_local_folder ()
const gchar * | e_mail_session_get_local_folder_uri ()
GList * | e_mail_session_get_available_junk_filters ()
EMailJunkFilter * | e_mail_session_get_junk_filter_by_name ()
CamelFolder * | e_mail_session_get_inbox_sync ()
void | e_mail_session_get_inbox ()
CamelFolder * | e_mail_session_get_inbox_finish ()
CamelFolder * | e_mail_session_get_trash_sync ()
void | e_mail_session_get_trash ()
CamelFolder * | e_mail_session_get_trash_finish ()
CamelFolder * | e_mail_session_uri_to_folder_sync ()
void | e_mail_session_uri_to_folder ()
CamelFolder * | e_mail_session_uri_to_folder_finish ()
EMVFolderContext * | e_mail_session_create_vfolder_context ()
void | e_mail_session_flush_outbox ()
void | e_mail_session_schedule_outbox_flush ()
void | e_mail_session_cancel_scheduled_outbox_flush ()
gboolean | e_mail_session_mark_service_used_sync ()
void | e_mail_session_unmark_service_used ()
void | e_mail_session_emit_allow_auth_prompt ()
gboolean | e_mail_session_is_archive_folder ()
void | e_mail_session_emit_connect_store ()
gboolean | e_binding_transform_service_to_source ()
gboolean | e_binding_transform_source_to_service ()
void | mail_session_flush_filter_log ()
const gchar * | mail_session_get_data_dir ()
const gchar * | mail_session_get_cache_dir ()
const gchar * | mail_session_get_config_dir ()

## Properties

MailFolderCache * | folder-cache | Read
CamelStore * | local-store | Read
ESourceRegistry * | registry | Read / Write / Construct Only
CamelStore * | vfolder-store | Read

## Signals

void | allow-auth-prompt | Run First
void | archive-folder-changed | Run First
void | connect-store | Run First
void | flush-outbox | Run First
gchar* | get-recipient-certificate | Action
void | refresh-service | Run Last
void | store-added | Run First
void | store-removed | Run First

## Types and Values

#define | E_MAIL_SESSION_LOCAL_UID
#define | E_MAIL_SESSION_VFOLDER_UID

## Object Hierarchy

        GObject
        ╰── CamelSession
            ╰── EMailSession

## Description

## Functions

### e_mail_session_new ()

    EMailSession *
    e_mail_session_new (ESourceRegistry *registry);

### e_mail_session_get_registry ()

    ESourceRegistry *
    e_mail_session_get_registry (EMailSession *session);

### e_mail_session_get_folder_cache ()

    MailFolderCache *
    e_mail_session_get_folder_cache (EMailSession *session);

### e_mail_session_get_local_store ()

    CamelStore *
    e_mail_session_get_local_store (EMailSession *session);

### e_mail_session_get_vfolder_store ()

    CamelStore *
    e_mail_session_get_vfolder_store (EMailSession *session);

### e_mail_session_get_local_folder ()

    CamelFolder *
    e_mail_session_get_local_folder (EMailSession *session,
                                     EMailLocalFolder type);

### e_mail_session_get_local_folder_uri ()

    const gchar *
    e_mail_session_get_local_folder_uri (EMailSession *session,
                                         EMailLocalFolder type);

### e_mail_session_get_available_junk_filters ()

    GList *
    e_mail_session_get_available_junk_filters
                                   (EMailSession *session);

### e_mail_session_get_junk_filter_by_name ()

    EMailJunkFilter *
    e_mail_session_get_junk_filter_by_name
                                   (EMailSession *session,
                                    const gchar *filter_name);

Looks up an EMailJunkFilter extension by its filter name, as specified in its class structure. If no match is found, the function returns `NULL`.

#### Parameters

session | an EMailSession |
filter_name | a junk filter name |

#### Returns

an EMailJunkFilter, or `NULL`

### e_mail_session_get_inbox_sync ()

    CamelFolder *
    e_mail_session_get_inbox_sync (EMailSession *session,
                                   const gchar *service_uid,
                                   GCancellable *cancellable,
                                   GError **error);

### e_mail_session_get_inbox ()

    void
    e_mail_session_get_inbox (EMailSession *session,
                              const gchar *service_uid,
                              gint io_priority,
                              GCancellable *cancellable,
                              GAsyncReadyCallback callback,
                              gpointer user_data);

### e_mail_session_get_inbox_finish ()

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

### e_mail_session_get_trash_sync ()

    CamelFolder *
    e_mail_session_get_trash_sync (EMailSession *session,
                                   const gchar *service_uid,
                                   GCancellable *cancellable,
                                   GError **error);

### e_mail_session_get_trash ()

    void
    e_mail_session_get_trash (EMailSession *session,
                              const gchar *service_uid,
                              gint io_priority,
                              GCancellable *cancellable,
                              GAsyncReadyCallback callback,
                              gpointer user_data);

### e_mail_session_get_trash_finish ()

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

### e_mail_session_uri_to_folder_sync ()

    CamelFolder *
    e_mail_session_uri_to_folder_sync (EMailSession *session,
                                       const gchar *folder_uri,
                                       CamelStoreGetFolderFlags flags,
                                       GCancellable *cancellable,
                                       GError **error);

### e_mail_session_uri_to_folder ()

    void
    e_mail_session_uri_to_folder (EMailSession *session,
                                  const gchar *folder_uri,
                                  CamelStoreGetFolderFlags flags,
                                  gint io_priority,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);

### e_mail_session_uri_to_folder_finish ()

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

### e_mail_session_create_vfolder_context ()

    EMVFolderContext *
    e_mail_session_create_vfolder_context (EMailSession *session);

### e_mail_session_flush_outbox ()

    void
    e_mail_session_flush_outbox (EMailSession *session);

### e_mail_session_schedule_outbox_flush ()

    void
    e_mail_session_schedule_outbox_flush (EMailSession *session,
                                          gint delay_minutes);

### e_mail_session_cancel_scheduled_outbox_flush ()

    void
    e_mail_session_cancel_scheduled_outbox_flush
                                   (EMailSession *session);

### e_mail_session_mark_service_used_sync ()

    gboolean
    e_mail_session_mark_service_used_sync (EMailSession *session,
                                           CamelService *service,
                                           GCancellable *cancellable);

Marks the `service` as being used. If it is already in use, then waits for its release. The only reasons for a failure are either invalid parameters being passed in the function or the wait being cancelled. Use `e_mail_session_unmark_service_used()` to notice the `session` that that the `service` is no longer being used by the caller.

#### Parameters

session | an EMailSession |
service | a CamelService |
cancellable | a GCancellable, or NULL. | [allow none]

#### Returns

Whether successfully waited for the `service` .

Since: 3.16

### e_mail_session_unmark_service_used ()

    void
    e_mail_session_unmark_service_used (EMailSession *session,
                                        CamelService *service);

Frees a "use lock" on the `service` , thus it can be used by others. If anything is waiting for it in `e_mail_session_mark_service_used_sync()`, then it is woken up.

#### Parameters

session | an EMailSession |
service | a CamelService |

Since: 3.16

### e_mail_session_emit_allow_auth_prompt ()

    void
    e_mail_session_emit_allow_auth_prompt (EMailSession *session,
                                           ESource *source);

Emits 'allow-auth-prompt' on `session` for `source` . This lets any listeners know to enable credentials prompt for this `source` .

#### Parameters

session | an EMailSession |
source | an ESource |

Since: 3.16

### e_mail_session_is_archive_folder ()

    gboolean
    e_mail_session_is_archive_folder (EMailSession *session,
                                      const gchar *folder_uri);

#### Parameters

session | an EMailSession |
folder_uri | a folder URI |

#### Returns

whether the `folder_uri` is one of configured archive folders

Since: 3.34

### e_mail_session_emit_connect_store ()

    void
    e_mail_session_emit_connect_store (EMailSession *session,
                                       CamelStore *store);

Emits 'connect-store' on `session` for `store` . This lets any listeners know to connect the `store` .

#### Parameters

session | an EMailSession |
store | a CamelStore |

Since: 3.34

### e_binding_transform_service_to_source ()

    gboolean
    e_binding_transform_service_to_source (GBinding *binding,
                                           const GValue *source_value,
                                           GValue *target_value,
                                           gpointer session);

### e_binding_transform_source_to_service ()

    gboolean
    e_binding_transform_source_to_service (GBinding *binding,
                                           const GValue *source_value,
                                           GValue *target_value,
                                           gpointer session);

### mail_session_flush_filter_log ()

    void
    mail_session_flush_filter_log (EMailSession *session);

### mail_session_get_data_dir ()

    const gchar *
    mail_session_get_data_dir (void);

### mail_session_get_cache_dir ()

    const gchar *
    mail_session_get_cache_dir (void);

### mail_session_get_config_dir ()

    const gchar *
    mail_session_get_config_dir (void);

## Types and Values

### E_MAIL_SESSION_LOCAL_UID

    #define E_MAIL_SESSION_LOCAL_UID   "local" /* "On This Computer" */

### E_MAIL_SESSION_VFOLDER_UID

    #define E_MAIL_SESSION_VFOLDER_UID "vfolder" /* "Search Folders" */

## Property Details

### The `“folder-cache”` property

      “folder-cache”             MailFolderCache *

Owner: EMailSession

Flags: Read

### The `“local-store”` property

      “local-store”              CamelStore *

Built-in local store.

Owner: EMailSession

Flags: Read

### The `“registry”` property

      “registry”                 ESourceRegistry *

Data source registry.

Owner: EMailSession

Flags: Read / Write / Construct Only

### The `“vfolder-store”` property

      “vfolder-store”            CamelStore *

Built-in search folder store.

Owner: EMailSession

Flags: Read

## Signal Details

### The `“allow-auth-prompt”` signal

    void
    user_function (EMailSession *session,
                   ESource      *source,
                   gpointer      user_data)

This signal is emitted with `e_mail_session_emit_allow_auth_prompt()` to let any listeners know to enable credentials prompt for the given `source` .

#### Parameters

session | the EMailSession that emitted the signal |
source | an ESource |
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 3.16

### The `“archive-folder-changed”` signal

    void
    user_function (EMailSession *session,
                   gchar        *service_uid,
                   gchar        *old_folder_uri,
                   gchar        *new_folder_uri,
                   gpointer      user_data)

Notifies about changes in archive folders setup.

#### Parameters

session | the EMailSession that emitted the signal |
service_uid | UID of a CamelService, whose archive folder setting changed |
old_folder_uri | an old archive folder URI, or `NULL`, when none had been set already. | [nullable]
new_folder_uri | a new archive folder URI, or `NULL`, when none had been set. | [nullable]
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 3.34

### The `“connect-store”` signal

    void
    user_function (EMailSession *session,
                   CamelStore   *store,
                   gpointer      user_data)

This signal is emitted with `e_mail_session_emit_connect_store()` to let any listeners know to connect the given `store` .

#### Parameters

session | the EMailSession that emitted the signal |
store | a CamelStore |
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 3.34

### The `“flush-outbox”` signal

    void
    user_function (EMailSession *session,
                   gpointer      user_data)

Emitted if the send folder should be flushed.

#### Parameters

session | the email session |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### The `“get-recipient-certificate”` signal

    gchar*
    user_function (EMailSession *session,
                   guint         flags,
                   gchar        *email_address,
                   gpointer      user_data)

This signal is used to get recipient's S/MIME certificate or PGP key for encryption, as part of `camel_session_get_recipient_certificates_sync()`. The listener is not supposed to do any expensive look ups, it should only check whether it has the certificate available for the given `email_address` and eventually return it as base64 encoded string.

The caller of the action signal will free returned pointer with `g_free()`, when no longer needed.

#### Parameters

session | the EMailSession that emitted the signal |
flags | a bit-or of CamelRecipientCertificateFlags |
email_address | recipient's email address |
user_data | user data set when the signal handler was connected. |

#### Returns

`NULL` when the certificate not known, or a newly allocated base64-encoded string with the certificate.

[transfer full][nullable]

Flags: Action

Since: 3.30

### The `“refresh-service”` signal

    void
    user_function (EMailSession *session,
                   CamelService *service,
                   gpointer      user_data)

Emitted when `service` should be refreshed.

#### Parameters

session | the EMailSession that emitted the signal |
service | a CamelService |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“store-added”` signal

    void
    user_function (EMailSession *session,
                   CamelStore   *store,
                   gpointer      user_data)

Emitted when a store is added

#### Parameters

session | the EMailSession that emitted the signal |
store | a CamelStore |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### The `“store-removed”` signal

    void
    user_function (EMailSession *session,
                   CamelStore   *store,
                   gpointer      user_data)

Emitted when a store is removed

#### Parameters

session | the EMailSession that emitted the signal |
store | a CamelStore |
user_data | user data set when the signal handler was connected. |

Flags: Run First