TnyMsg*
modest_tny_msg_new (const gchar* mailto, const gchar* from, const gchar *cc,
TnyMsg*
modest_tny_msg_new (const gchar* mailto, const gchar* from, const gchar *cc,
const gchar *references, const gchar *in_reply_to,
const gchar *body,
GList *attachments, gint *attached, GError **err)
const gchar *references, const gchar *in_reply_to,
const gchar *body,
GList *attachments, gint *attached, GError **err)
/* Create new msg */
new_msg = modest_formatter_create_message (NULL, TRUE, (attachments != NULL), FALSE);
header = tny_msg_get_header (new_msg);
/* Create new msg */
new_msg = modest_formatter_create_message (NULL, TRUE, (attachments != NULL), FALSE);
header = tny_msg_get_header (new_msg);
if ((from != NULL) && (strlen(from) > 0)) {
tny_header_set_from (TNY_HEADER (header), from);
tny_header_set_replyto (TNY_HEADER (header), from);
if ((from != NULL) && (strlen(from) > 0)) {
tny_header_set_from (TNY_HEADER (header), from);
tny_header_set_replyto (TNY_HEADER (header), from);
tny_header_set_subject (TNY_HEADER (header), subject);
content_type = get_content_type(body);
tny_header_set_subject (TNY_HEADER (header), subject);
content_type = get_content_type(body);
/* Add the body of the new mail */
/* This is needed even if body is NULL or empty. */
add_body_part (new_msg, body, content_type);
g_free (content_type);
/* Add the body of the new mail */
/* This is needed even if body is NULL or empty. */
add_body_part (new_msg, body, content_type);
g_free (content_type);
/* Add attachments */
if (attachments)
tmp_attached = add_attachments (TNY_MIME_PART (new_msg), attachments, FALSE, err);
/* Add attachments */
if (attachments)
tmp_attached = add_attachments (TNY_MIME_PART (new_msg), attachments, FALSE, err);