GNURLOPT_MAIL_RCPT(3)
π GNURLOPT_MAIL_RCPT(3) π
okay bestie, so this one lives in the curl_easy_setopt options fam (that's the manual name, iykyk) and it's literally all about telling your SMTP server who's getting the mail π
β¨ NAME β¨
CURLOPT_MAIL_RCPT β the list of SMTP mail recipients π
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT,
struct curl_slist *rcpts);
π DESCRIPTION π
So you pass a pointer to a linked list of recipients β these are the lucky people/things getting your SMTP mail request, no cap. The list has to be a fully valid list of struct curl_slist structs, properly filled in (like, do it right, bestie π). Build it with curl_slist_append(3) and then clean up the whole entire list with curl_slist_free_all(3) when you're done β leaving it lying around is not the vibe.
When you're doing a mail transfer, each recipient should be specified inside a pair of angled brackets (<>). BUT β and this is the cute part β if you don't use an angled bracket as the first character, libcurl will assume you handed it a single email address and will enclose that address within brackets for you π«Ά (it's giving "don't worry, I got you").
When you're doing an address verification (that's the VRFY command), each recipient should be specified as the user name, or the user name and domain β as per Section 3.5 of RFC5321, periodt π.
When you're doing a mailing list expand (the EXPN command), each recipient should be specified using the mailing list name β like "Friends" or "London-Office" β.
πΈ DEFAULT πΈ
NULL
π PROTOCOLS π
SMTP
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
struct curl_slist *list;
list = curl_slist_append(NULL, "root@localhost");
list = curl_slist_append(list, "person@example.com");
curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, list);
ret = curl_easy_perform(curl);
curl_slist_free_all(list);
curl_easy_cleanup(curl);
}
like, look at her go π two recipients, one URL, one curl_easy_perform, and then responsible cleanup. main character energy fr fr.
π§ AVAILABILITY π§
Added in 7.20.0. The VRFY and EXPN logic was added in 7.34.0 π
π₯ RETURN VALUE π₯
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. that's it, that's the whole vibe check π
β SEE ALSO β
heads up bestie: this page islibcurl 7.37.0, dated19 Jun 2014β yes she's vintage, and yes she still slays π β¨π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2019, 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