## EMsgComposer

EMsgComposer

## Synopsis

    struct              EMsgComposer;
    EMsgComposer *      e_msg_composer_new                  (EShell *shell);
    EMsgComposer *      e_msg_composer_new_with_message     (EShell *shell,
                                                             CamelMimeMessage *message,
                                                             gboolean keep_signature,
                                                             GCancellable *cancellable);
    EMsgComposer *      e_msg_composer_new_from_url         (EShell *shell,
                                                             const gchar *url);
    EMsgComposer *      e_msg_composer_new_redirect         (EShell *shell,
                                                             CamelMimeMessage *message,
                                                             const gchar *identity_uid,
                                                             GCancellable *cancellable);
    EFocusTracker *     e_msg_composer_get_focus_tracker    (EMsgComposer *composer);
    CamelSession *      e_msg_composer_ref_session          (EMsgComposer *composer);
    EShell *            e_msg_composer_get_shell            (EMsgComposer *composer);
    EWebViewGtkHTML *   e_msg_composer_get_web_view         (EMsgComposer *composer);
    void                e_msg_composer_send                 (EMsgComposer *composer);
    void                e_msg_composer_save_to_drafts       (EMsgComposer *composer);
    void                e_msg_composer_save_to_outbox       (EMsgComposer *composer);
    void                e_msg_composer_print                (EMsgComposer *composer,
                                                             GtkPrintOperationAction print_action);
    void                e_msg_composer_set_body_text        (EMsgComposer *composer,
                                                             const gchar *text,
                                                             gboolean update_signature);
    void                e_msg_composer_set_body             (EMsgComposer *composer,
                                                             const gchar *body,
                                                             const gchar *mime_type);
    void                e_msg_composer_add_header           (EMsgComposer *composer,
                                                             const gchar *name,
                                                             const gchar *value);
    void                e_msg_composer_set_header           (EMsgComposer *composer,
                                                             const gchar *name,
                                                             const gchar *value);
    void                e_msg_composer_remove_header        (EMsgComposer *composer,
                                                             const gchar *name);
    void                e_msg_composer_set_draft_headers    (EMsgComposer *composer,
                                                             const gchar *folder_uri,
                                                             const gchar *message_uid);
    void                e_msg_composer_set_source_headers   (EMsgComposer *composer,
                                                             const gchar *folder_uri,
                                                             const gchar *message_uid,
                                                             CamelMessageFlags flags);
    void                e_msg_composer_attach               (EMsgComposer *composer,
                                                             CamelMimePart *mime_part);
    CamelMimePart *     e_msg_composer_add_inline_image_from_file
                                                            (EMsgComposer *composer,
                                                             const gchar *filename);
    void                e_msg_composer_add_inline_image_from_mime_part
                                                            (EMsgComposer *composer,
                                                             CamelMimePart *part);
    void                e_msg_composer_get_message          (EMsgComposer *composer,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    CamelMimeMessage *  e_msg_composer_get_message_finish   (EMsgComposer *composer,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                e_msg_composer_get_message_print    (EMsgComposer *composer,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    CamelMimeMessage *  e_msg_composer_get_message_print_finish
                                                            (EMsgComposer *composer,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                e_msg_composer_get_message_draft    (EMsgComposer *composer,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    CamelMimeMessage *  e_msg_composer_get_message_draft_finish
                                                            (EMsgComposer *composer,
                                                             GAsyncResult *result,
                                                             GError **error);
    CamelInternetAddress * e_msg_composer_get_from          (EMsgComposer *composer);
    CamelInternetAddress * e_msg_composer_get_reply_to      (EMsgComposer *composer);
    void                e_msg_composer_clear_inlined_table  (EMsgComposer *composer);
    void                e_msg_composer_add_message_attachments
                                                            (EMsgComposer *composer,
                                                             CamelMimeMessage *message,
                                                             gboolean just_inlines);
    void                e_msg_composer_request_close        (EMsgComposer *composer);
    gboolean            e_msg_composer_can_close            (EMsgComposer *composer,
                                                             gboolean can_save_draft);
    void                e_msg_composer_reply_indent         (EMsgComposer *composer);
    EComposerHeaderTable * e_msg_composer_get_header_table  (EMsgComposer *composer);
    EAttachmentView *   e_msg_composer_get_attachment_view  (EMsgComposer *composer);
    GByteArray *        e_msg_composer_get_raw_message_text (EMsgComposer *composer);
    gboolean            e_msg_composer_is_exiting           (EMsgComposer *composer);
    GList *             e_load_spell_languages              (void);
    void                e_save_spell_languages              (GList *spell_languages);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBin
                               +----GtkWindow
                                     +----GtkhtmlEditor
                                           +----EMsgComposer

## Implemented Interfaces

EMsgComposer implements AtkImplementorIface, GtkBuildable, EAlertSink and EExtensible.

## Properties

      "focus-tracker"            EFocusTracker*        : Read
      "shell"                    EShell*               : Read / Write / Construct Only

## Signals

      "presend"                                        : Run Last
      "print"                                          : Run Last
      "save-to-drafts"                                 : Run Last
      "save-to-outbox"                                 : Run Last
      "send"                                           : Run Last

## Description

## Details

### struct EMsgComposer

    struct EMsgComposer;

### e_msg_composer_new ()

    EMsgComposer *      e_msg_composer_new                  (EShell *shell);

Create a new message composer widget.

`shell` : | an EShell
Returns : | A pointer to the newly created widget

### e_msg_composer_new_with_message ()

    EMsgComposer *      e_msg_composer_new_with_message     (EShell *shell,
                                                             CamelMimeMessage *message,
                                                             gboolean keep_signature,
                                                             GCancellable *cancellable);

Create a new message composer widget.

Note: Designed to work only for messages constructed using Evolution.

`shell` : | an EShell
`message` : | The message to use as the source
`keep_signature` : | Keep message signature, if any
`cancellable` : | optional GCancellable object, or `NULL`
Returns : | A pointer to the newly created widget

### e_msg_composer_new_from_url ()

    EMsgComposer *      e_msg_composer_new_from_url         (EShell *shell,
                                                             const gchar *url);

Create a new message composer widget, and fill in fields as defined by the provided URL.

`shell` : | an EShell
`url` : | a mailto URL

### e_msg_composer_new_redirect ()

    EMsgComposer *      e_msg_composer_new_redirect         (EShell *shell,
                                                             CamelMimeMessage *message,
                                                             const gchar *identity_uid,
                                                             GCancellable *cancellable);

Create a new message composer widget.

`shell` : | an EShell
`message` : | The message to use as the source
Returns : | A pointer to the newly created widget

### e_msg_composer_get_focus_tracker ()

    EFocusTracker *     e_msg_composer_get_focus_tracker    (EMsgComposer *composer);

### e_msg_composer_ref_session ()

    CamelSession *      e_msg_composer_ref_session          (EMsgComposer *composer);

Returns the mail module's global CamelSession instance. Calling this function will load the mail module if it isn't already loaded.

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

`composer` : | an EMsgComposer
Returns : | the mail module's CamelSession

### e_msg_composer_get_shell ()

    EShell *            e_msg_composer_get_shell            (EMsgComposer *composer);

Returns the EShell that was passed to `e_msg_composer_new()`.

`composer` : | an EMsgComposer
Returns : | the EShell

### e_msg_composer_get_web_view ()

    EWebViewGtkHTML *   e_msg_composer_get_web_view         (EMsgComposer *composer);

Returns the EWebView widget in `composer`.

`composer` : | an EMsgComposer
Returns : | the EWebView

### e_msg_composer_send ()

    void                e_msg_composer_send                 (EMsgComposer *composer);

Send the message in `composer`.

`composer` : | an EMsgComposer

### e_msg_composer_save_to_drafts ()

    void                e_msg_composer_save_to_drafts       (EMsgComposer *composer);

Save the message in `composer` to the selected account's Drafts folder.

`composer` : | an EMsgComposer

### e_msg_composer_save_to_outbox ()

    void                e_msg_composer_save_to_outbox       (EMsgComposer *composer);

Save the message in `composer` to the local Outbox folder.

`composer` : | an EMsgComposer

### e_msg_composer_print ()

    void                e_msg_composer_print                (EMsgComposer *composer,
                                                             GtkPrintOperationAction print_action);

Print the message in `composer`.

`composer` : | an EMsgComposer
`print_action` : | the print action to start

### e_msg_composer_set_body_text ()

    void                e_msg_composer_set_body_text        (EMsgComposer *composer,
                                                             const gchar *text,
                                                             gboolean update_signature);

Loads the given HTML text into the editor.

`composer` : | a composer object
`text` : | the HTML text to initialize the editor with
`update_signature` : | whether update signature in the text after setting it; Might be usually called with TRUE.

### e_msg_composer_set_body ()

    void                e_msg_composer_set_body             (EMsgComposer *composer,
                                                             const gchar *body,
                                                             const gchar *mime_type);

Loads the given data into the composer as the message body.

`composer` : | a composer object
`body` : | the data to initialize the composer with
`mime_type` : | the MIME type of data

### e_msg_composer_add_header ()

    void                e_msg_composer_add_header           (EMsgComposer *composer,
                                                             const gchar *name,
                                                             const gchar *value);

Adds a new custom header created from `name` and `value`. The header is not shown in the user interface but will be added to the resulting MIME message when sending or saving.

`composer` : | an EMsgComposer
`name` : | the header's name
`value` : | the header's value

### e_msg_composer_set_header ()

    void                e_msg_composer_set_header           (EMsgComposer *composer,
                                                             const gchar *name,
                                                             const gchar *value);

Replaces all custom headers matching `name` that were added with `e_msg_composer_add_header()` or `e_msg_composer_set_header()`, with a new custom header created from `name` and `value`. The header is not shown in the user interface but will be added to the resulting MIME message when sending or saving.

`composer` : | an EMsgComposer
`name` : | the header's name
`value` : | the header's value

### e_msg_composer_remove_header ()

    void                e_msg_composer_remove_header        (EMsgComposer *composer,
                                                             const gchar *name);

Removes all custom headers matching `name` that were added with `e_msg_composer_add_header()` or `e_msg_composer_set_header()`.

`composer` : | an EMsgComposer
`name` : | the header's name

### e_msg_composer_set_draft_headers ()

    void                e_msg_composer_set_draft_headers    (EMsgComposer *composer,
                                                             const gchar *folder_uri,
                                                             const gchar *message_uid);

Add special X-Evolution-Draft headers to remember the most recently saved draft message, even across Evolution sessions. These headers can be used to mark the draft message for deletion after saving a newer draft or sending the composed message.

`composer` : | an EMsgComposer
`folder_uri` : | folder URI of the last saved draft
`message_uid` : | message UID of the last saved draft

### e_msg_composer_set_source_headers ()

    void                e_msg_composer_set_source_headers   (EMsgComposer *composer,
                                                             const gchar *folder_uri,
                                                             const gchar *message_uid,
                                                             CamelMessageFlags flags);

Add special X-Evolution-Source headers to remember the message being forwarded or replied to, even across Evolution sessions. These headers can be used to set appropriate flags on the source message after sending the composed message.

`composer` : | an EMsgComposer
`folder_uri` : | folder URI of the source message
`message_uid` : | message UID of the source message
`flags` : | flags to set on the source message after sending

### e_msg_composer_attach ()

    void                e_msg_composer_attach               (EMsgComposer *composer,
                                                             CamelMimePart *mime_part);

Attaches `attachment` to the message being composed in the composer.

`composer` : | a composer object
`mime_part` : | the CamelMimePart to attach

### e_msg_composer_add_inline_image_from_file ()

    CamelMimePart *     e_msg_composer_add_inline_image_from_file
                                                            (EMsgComposer *composer,
                                                             const gchar *filename);

This reads in the image in `filename` and adds it to `composer` as an inline image, to be wrapped in a multipart/related.

`composer` : | a composer object
`filename` : | the name of the file containing the image
Returns : | the newly-created CamelMimePart (which must be reffed if the caller wants to keep its own reference), or `NULL` on error.

### e_msg_composer_add_inline_image_from_mime_part ()

    void                e_msg_composer_add_inline_image_from_mime_part
                                                            (EMsgComposer *composer,
                                                             CamelMimePart *part);

This adds the mime part `part` to `composer` as an inline image, to be wrapped in a multipart/related.

`composer` : | a composer object
`part` : | a CamelMimePart containing image data

### e_msg_composer_get_message ()

    void                e_msg_composer_get_message          (EMsgComposer *composer,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Retrieve the message edited by the user as a CamelMimeMessage. The CamelMimeMessage object is created on the fly; subsequent calls to this function will always create new objects from scratch.

`composer` : | an EMsgComposer

### e_msg_composer_get_message_finish ()

    CamelMimeMessage *  e_msg_composer_get_message_finish   (EMsgComposer *composer,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_msg_composer_get_message_print ()

    void                e_msg_composer_get_message_print    (EMsgComposer *composer,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_msg_composer_get_message_print_finish ()

    CamelMimeMessage *  e_msg_composer_get_message_print_finish
                                                            (EMsgComposer *composer,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_msg_composer_get_message_draft ()

    void                e_msg_composer_get_message_draft    (EMsgComposer *composer,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_msg_composer_get_message_draft_finish ()

    CamelMimeMessage *  e_msg_composer_get_message_draft_finish
                                                            (EMsgComposer *composer,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_msg_composer_get_from ()

    CamelInternetAddress * e_msg_composer_get_from          (EMsgComposer *composer);

### e_msg_composer_get_reply_to ()

    CamelInternetAddress * e_msg_composer_get_reply_to      (EMsgComposer *composer);

### e_msg_composer_clear_inlined_table ()

    void                e_msg_composer_clear_inlined_table  (EMsgComposer *composer);

### e_msg_composer_add_message_attachments ()

    void                e_msg_composer_add_message_attachments
                                                            (EMsgComposer *composer,
                                                             CamelMimeMessage *message,
                                                             gboolean just_inlines);

Walk through all the mime parts in `message` and add them to the composer specified in `composer`.

`composer` : | the composer to add the attachments to.
`message` : | the source message to copy the attachments from.
`just_inlines` : | whether to attach all attachments or just add inline images.

### e_msg_composer_request_close ()

    void                e_msg_composer_request_close        (EMsgComposer *composer);

### e_msg_composer_can_close ()

    gboolean            e_msg_composer_can_close            (EMsgComposer *composer,
                                                             gboolean can_save_draft);

### e_msg_composer_reply_indent ()

    void                e_msg_composer_reply_indent         (EMsgComposer *composer);

### e_msg_composer_get_header_table ()

    EComposerHeaderTable * e_msg_composer_get_header_table  (EMsgComposer *composer);

### e_msg_composer_get_attachment_view ()

    EAttachmentView *   e_msg_composer_get_attachment_view  (EMsgComposer *composer);

### e_msg_composer_get_raw_message_text ()

    GByteArray *        e_msg_composer_get_raw_message_text (EMsgComposer *composer);

Returns : | the text/plain of the message from composer

### e_msg_composer_is_exiting ()

    gboolean            e_msg_composer_is_exiting           (EMsgComposer *composer);

### e_load_spell_languages ()

    GList *             e_load_spell_languages              (void);

### e_save_spell_languages ()

    void                e_save_spell_languages              (GList *spell_languages);

## Property Details

### The `"focus-tracker"` property

      "focus-tracker"            EFocusTracker*        : Read

### The `"shell"` property

      "shell"                    EShell*               : Read / Write / Construct Only

The EShell singleton.

## Signal Details

### The `"presend"` signal

    gboolean            user_function                      (EMsgComposer *emsgcomposer,
                                                            gpointer      user_data)         : Run Last

### The `"print"` signal

    void                user_function                      (EMsgComposer           *emsgcomposer,
                                                            GtkPrintOperationAction arg1,
                                                            CamelMimeMessage       *arg2,
                                                            EActivity              *arg3,
                                                            gpointer                user_data)         : Run Last

### The `"save-to-drafts"` signal

    void                user_function                      (EMsgComposer     *emsgcomposer,
                                                            CamelMimeMessage *arg1,
                                                            EActivity        *arg2,
                                                            gpointer          user_data)         : Run Last

### The `"save-to-outbox"` signal

    void                user_function                      (EMsgComposer     *emsgcomposer,
                                                            CamelMimeMessage *arg1,
                                                            EActivity        *arg2,
                                                            gpointer          user_data)         : Run Last

### The `"send"` signal

    void                user_function                      (EMsgComposer     *emsgcomposer,
                                                            CamelMimeMessage *arg1,
                                                            EActivity        *arg2,
                                                            gpointer          user_data)         : Run Last