2
0

curl_mime_subparts.3 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .TH curl_mime_subparts 3 "22 August 2017" "libcurl" "libcurl"
  25. .SH NAME
  26. curl_mime_subparts - set sub-parts of a multipart mime part
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts);
  31. .fi
  32. .SH DESCRIPTION
  33. \fIcurl_mime_subparts(3)\fP sets a multipart mime part's content from a mime
  34. structure.
  35. \fIpart\fP is a handle to the multipart part.
  36. \fIsubparts\fP is a mime structure handle holding the sub-parts. After
  37. \fIcurl_mime_subparts\fP succeeds, the mime structure handle belongs to the
  38. multipart part and must not be freed explicitly. It may however be updated by
  39. subsequent calls to mime API functions.
  40. Setting a part's contents multiple times is valid: only the value set by the
  41. last call is retained. It is possible to unassign previous part's contents by
  42. setting \fIsubparts\fP to NULL.
  43. .SH EXAMPLE
  44. .nf
  45. /* The inline part is an alternative proposing the html and the text
  46. versions of the email. */
  47. alt = curl_mime_init(curl);
  48. /* HTML message. */
  49. part = curl_mime_addpart(alt);
  50. curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED);
  51. curl_mime_type(part, "text/html");
  52. /* Text message. */
  53. part = curl_mime_addpart(alt);
  54. curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED);
  55. /* Create the inline part. */
  56. part = curl_mime_addpart(mime);
  57. curl_mime_subparts(part, alt);
  58. curl_mime_type(part, "multipart/alternative");
  59. slist = curl_slist_append(NULL, "Content-Disposition: inline");
  60. curl_mime_headers(part, slist, 1);
  61. .fi
  62. .SH AVAILABILITY
  63. As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
  64. .SH RETURN VALUE
  65. CURLE_OK or a CURL error code upon failure.
  66. .SH "SEE ALSO"
  67. .BR curl_mime_addpart "(3),"
  68. .BR curl_mime_init "(3)"