1curl_mime_subparts(3)           libcurl Manual           curl_mime_subparts(3)
2
3
4

NAME

6       curl_mime_subparts - set subparts of a multipart mime part
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts);
12

DESCRIPTION

14       curl_mime_subparts(3)  sets a multipart mime part's content from a mime
15       structure.
16
17       part is a handle to the multipart part.
18
19       subparts is  a  mime  structure  handle  holding  the  subparts.  After
20       curl_mime_subparts  succeeds,  the mime structure handle belongs to the
21       multipart part and must not be freed explicitly. It may however be  up‐
22       dated by subsequent calls to mime API functions.
23
24       Setting  a  part's  contents  twice is valid: only the value set by the
25       last call is retained. It is possible to unassign previous part's  con‐
26       tents by setting subparts to NULL.
27

EXAMPLE

29        /* The inline part is an alternative proposing the html and the text
30           versions of the email. */
31        alt = curl_mime_init(curl);
32
33        /* HTML message. */
34        part = curl_mime_addpart(alt);
35        curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED);
36        curl_mime_type(part, "text/html");
37
38        /* Text message. */
39        part = curl_mime_addpart(alt);
40        curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED);
41
42        /* Create the inline part. */
43        part = curl_mime_addpart(mime);
44        curl_mime_subparts(part, alt);
45        curl_mime_type(part, "multipart/alternative");
46        slist = curl_slist_append(NULL, "Content-Disposition: inline");
47        curl_mime_headers(part, slist, 1);
48

AVAILABILITY

50       As  long  as  at  least  one of HTTP, SMTP or IMAP is enabled. Added in
51       7.56.0.
52

RETURN VALUE

54       CURLE_OK or a CURL error code upon failure.
55

SEE ALSO

57       curl_mime_addpart(3), curl_mime_init(3)
58
59
60
61libcurl 7.82.0                 December 17, 2021         curl_mime_subparts(3)
Impressum