multiple attachments not possible

10 views
Skip to first unread message

Stefan Küppers

unread,
Dec 18, 2020, 5:06:23 PM12/18/20
to libcmime-devel
Hi , attaching one file to a CMimeMessage works fine.
But when I try to add a secont attachment to a CMimeMessage, no attachment will be inclluded in the resulting file, even the first one is missing.
Can you please advice, how more than one part can be added to a CMimeMessage ?

Axel Steiner

unread,
Dec 19, 2020, 11:19:52 AM12/19/20
to libcmim...@googlegroups.com
Hi,

do you have some sample code?

Bye, 
Axel

Von meinem iPhone gesendet

Am 18.12.2020 um 23:06 schrieb Stefan Küppers <stefanku...@gmail.com>:

Hi , attaching one file to a CMimeMessage works fine.
But when I try to add a secont attachment to a CMimeMessage, no attachment will be inclluded in the resulting file, even the first one is missing.
Can you please advice, how more than one part can be added to a CMimeMessage ?

--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "libcmime-devel" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an libcmime-deve...@googlegroups.com.
Wenn Sie diese Diskussion im Web verfolgen möchten, rufen Sie https://groups.google.com/d/msgid/libcmime-devel/1b774ced-27fc-4d69-9c44-4d335d50f88en%40googlegroups.com auf.

Stefan

unread,
Dec 19, 2020, 2:51:58 PM12/19/20
to libcmim...@googlegroups.com

Hi Alex,

thank you for your response.

Attached you find an example, and it seems that it now works:

Problem was that I called "cmime_message_add_generated_boundary(message);" for each attachment.

However, if I call it only once, it outputs two parts.


    // add the attachment
    if (num_attachments) {
            cmime_message_add_generated_boundary(message);
        for (int a=0; a<num_attachments; a++) {   
            // cmime_message_add_generated_boundary(message);
            CMimePart_T *part = cmime_part_new();       
                cmime_part_from_file(&part, attachment_list[a], message->linebreak);
                if (cmime_message_append_part(message, part) != 0) {
                        printf("failed to add mimepart\n");
                }

        }
    }


Best Regards,

Stefan.


Am 19.12.20 um 17:19 schrieb Axel Steiner:
Wenn Sie diese Diskussion im Web verfolgen möchten, rufen Sie https://groups.google.com/d/msgid/libcmime-devel/F16F461E-17EC-43A2-912D-F8DE046512E4%40treibsand.com auf.
create_mime_message_part_from_file.c

Axel Steiner

unread,
Dec 23, 2020, 4:47:36 PM12/23/20
to libcmim...@googlegroups.com
Hi,

thank you for your response.

Attached you find an example, and it seems that it now works:Problem was that I called "cmime_message_add_generated_boundary(message);" for each attachment.

normally you just need one boundary, as long you don‘t have nested mime parts.
The documentation is not very accurate here unfortunately. I‘ll adjust that.

Bye,
Axel
Reply all
Reply to author
Forward
0 new messages