gnurl_mime_init(3)
π gnurl_mime_init(3) π
okay so bestie, welcome to the libgnurl manual β this page is literally about gnurl_mime_init(3), and the vibe check says: mime handle creation. slay. π
πΈ NAME πΈ
curl_mime_initβ create a mime handle, bestie. that's the whole NAME-section moment. β¨
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
curl_mime * curl_mime_init(CURL * easy_handle);
π DESCRIPTION π
curl_mime_init(3) creates a handle to a brand-new, empty mime structure. That structure is intended to be used with easy_handle. It starts empty, and then you can fill it in later using the mime API. After that, you attach it to easy_handle using the option CURLOPT_MIMEPOST(3) inside a curl_easy_setopt(3) call. π«Ά
Using a mime handle is the recommended way to post an HTTP form, to format and send a multi-part e-mail with SMTP, or to upload such an e-mail to an IMAP server. periodt. π
π¦ AVAILABILITY π¦
This is available as long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0 β noted, no cap. β
π RETURN VALUE π
A mime struct handle, or NULL upon failure. that's it, that's the tea. π
π₯ EXAMPLE π₯
okay bestie, here's the example β code is code, so keep it exact:
CURL *easy = curl_easy_init();
curl_mime *mime;
curl_mimepart *part;
/* Build an HTTP form with a single field named "data", */
mime = curl_mime_init(easy);
part = curl_mime_addpart(mime);
curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED);
curl_mime_name(part, "data");
/* Post and send it. */
curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime);
curl_easy_setopt(easy, CURLOPT_URL, "http://example.com");
curl_easy_perform(easy);
/* Clean-up. */
curl_easy_cleanup(easy);
curl_mime_free(mime);
π SEE ALSO π
go check out curl_mime_addpart(3), curl_mime_free(3), and CURLOPT_MIMEPOST(3) β iykyk. π
xoxo, the libgnurl manual β source/version libcurl 7.56.0, dated 22 August 2017 π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms