- /* Create new msg */
- new_msg = TNY_MSG (tny_camel_msg_new ());
- header = TNY_HEADER (tny_camel_header_new ());
-
- /* WARNING: set the header before assign values to it */
- tny_msg_set_header (new_msg, header);
- tny_header_set_from (TNY_HEADER (header), from);
- tny_header_set_replyto (TNY_HEADER (header), from);
- tny_header_set_to (TNY_HEADER (header), to);
- tny_header_set_cc (TNY_HEADER (header), cc);
- tny_header_set_bcc (TNY_HEADER (header), bcc);
- tny_header_set_subject (TNY_HEADER (header), subject);
-
- content_type = get_content_type(body);
-
- /* Add the body of the new mail */
- add_body_part (new_msg, body, (const gchar *) content_type,
- (attachments_list == NULL) ? FALSE : TRUE);
-
- /* Add attachments */
- add_attachments (new_msg, (GList*) attachments_list);
-
- /* Send mail */
- tny_transport_account_send (transport_account, new_msg, NULL); /* FIXME */
+ new_msg = modest_tny_msg_new (to, from, cc, bcc, subject, body, NULL); /* FIXME: attachments */
+ if (!new_msg) {
+ g_printerr ("modest: failed to create a new msg\n");
+ return;
+ }
+
+ modest_mail_operation_send_mail (self, transport_account, new_msg);