summaryrefslogtreecommitdiff
path: root/docs/libcurl/curl_mime_subparts.3
diff options
context:
space:
mode:
authorSeonah Moon <seonah1.moon@samsung.com>2024-01-02 20:07:54 +0900
committerSeonah Moon <seonah1.moon@samsung.com>2024-01-02 20:37:43 +0900
commitaf71747bfb8e0dfb8b2870e30d720ce10b839814 (patch)
treedfd86789c7a44fccf1847280213d4ff10e41cc06 /docs/libcurl/curl_mime_subparts.3
parentb16a7a56e08377965863acf50afb7d91f32ba995 (diff)
downloadcurl-af71747bfb8e0dfb8b2870e30d720ce10b839814.tar.gz
curl-af71747bfb8e0dfb8b2870e30d720ce10b839814.tar.bz2
curl-af71747bfb8e0dfb8b2870e30d720ce10b839814.zip
Imported Upstream version 8.5.0upstream/8.5.0upstream
Change-Id: I8f77c680623836749aba616cecd0390fc34b0c3c
Diffstat (limited to 'docs/libcurl/curl_mime_subparts.3')
-rw-r--r--docs/libcurl/curl_mime_subparts.355
1 files changed, 34 insertions, 21 deletions
diff --git a/docs/libcurl/curl_mime_subparts.3 b/docs/libcurl/curl_mime_subparts.3
index a86ddf772..963270def 100644
--- a/docs/libcurl/curl_mime_subparts.3
+++ b/docs/libcurl/curl_mime_subparts.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -21,7 +21,7 @@
.\" * SPDX-License-Identifier: curl
.\" *
.\" **************************************************************************
-.TH curl_mime_subparts 3 "September 20, 2022" "libcurl 7.86.0" "libcurl Manual"
+.TH curl_mime_subparts 3 "December 04, 2023" "libcurl 8.5.0" "libcurl"
.SH NAME
curl_mime_subparts - set sub-parts of a multipart mime part
@@ -38,7 +38,7 @@ structure.
\fIpart\fP is a handle to the multipart part.
\fIsubparts\fP is a mime structure handle holding the sub-parts. After
-\fIcurl_mime_subparts\fP succeeds, the mime structure handle belongs to the
+\fIcurl_mime_subparts(3)\fP succeeds, the mime structure handle belongs to the
multipart part and must not be freed explicitly. It may however be updated by
subsequent calls to mime API functions.
@@ -47,30 +47,43 @@ last call is retained. It is possible to unassign previous part's contents by
setting \fIsubparts\fP to NULL.
.SH EXAMPLE
.nf
- /* The inline part is an alternative proposing the html and the text
- versions of the email. */
- alt = curl_mime_init(curl);
- /* HTML message. */
- part = curl_mime_addpart(alt);
- curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED);
- curl_mime_type(part, "text/html");
+static char *inline_html = "<title>example</title>";
+static char *inline_text = "once upon the time";
- /* Text message. */
- part = curl_mime_addpart(alt);
- curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct curl_slist *slist;
- /* Create the inline part. */
- part = curl_mime_addpart(mime);
- curl_mime_subparts(part, alt);
- curl_mime_type(part, "multipart/alternative");
- slist = curl_slist_append(NULL, "Content-Disposition: inline");
- curl_mime_headers(part, slist, 1);
+ /* The inline part is an alternative proposing the html and the text
+ versions of the email. */
+ curl_mime *alt = curl_mime_init(curl);
+ curl_mimepart *part;
+
+ /* HTML message. */
+ part = curl_mime_addpart(alt);
+ curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED);
+ curl_mime_type(part, "text/html");
+
+ /* Text message. */
+ part = curl_mime_addpart(alt);
+ curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED);
+
+ /* Create the inline part. */
+ part = curl_mime_addpart(alt);
+ curl_mime_subparts(part, alt);
+ curl_mime_type(part, "multipart/alternative");
+ slist = curl_slist_append(NULL, "Content-Disposition: inline");
+ curl_mime_headers(part, slist, 1);
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
.SH RETURN VALUE
CURLE_OK or a CURL error code upon failure.
.SH "SEE ALSO"
-.BR curl_mime_addpart "(3),"
-.BR curl_mime_init "(3)"
+.BR curl_mime_addpart (3),
+.BR curl_mime_init (3)