- tny_msg_mime_part_iface_construct_from_stream (TNY_MSG_MIME_PART_IFACE(new_msg),
- body_stream, content_type);
+ for ( pos = (GList *)attachments_list;
+ pos;
+ pos = pos->next ) {
+ attachment = pos->data;
+ attachment_filename = modest_tny_attachment_get_name(attachment);
+ attachment_stream = modest_tny_attachment_get_stream(attachment);
+ attachment_part = TNY_MSG_MIME_PART_IFACE (tny_msg_mime_part_new (
+ camel_mime_part_new()));
+
+ attachment_content_type = modest_tny_attachment_get_mime_type(attachment);
+
+ tny_msg_mime_part_iface_construct_from_stream (attachment_part,
+ attachment_stream,
+ attachment_content_type);
+ tny_stream_iface_reset (attachment_stream);
+
+ tny_msg_mime_part_iface_set_filename(attachment_part, attachment_filename);
+
+ tny_msg_iface_add_part (new_msg, attachment_part);
+ //g_object_unref(G_OBJECT(attachment_part));
+ //close(file);
+ }