GNURLOPT_MAIL_FROM(3)
π GNURLOPT_MAIL_FROM(3) β like, the curl_easy_setopt options era, bestie π
okay so real talk, this whole page lives under the curl_easy_setopt options umbrella (that's the manual name, don't @ me), and it's about one very specific little setting. grab a strawberry π and let's go.
β¨ NAME β¨
CURLOPT_MAIL_FROM β the SMTP sender address, aka "who is this email even FROM" π
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_FROM, char *from);
that's it. that's the whole vibe check. π«Ά
πΈ DESCRIPTION πΈ
So you pass a pointer to a null-terminated string as the parameter, bestie. That string is what you use to specify the sender's email address when you're sending SMTP mail with libcurl.
Now here's the iconic detail: an originator email address should be specified with angled brackets (<>) around it β and if you don't specify them, they'll just get added automatically for you. the way that libcurl has your back ππ
And a heads up, because this one's a little real: if this parameter is not specified, then an empty address gets sent to the mail server, which may cause the email to be rejected. so likeβ¦ maybe specify it? π
Good news though β the application does not have to keep the string around after setting this option. set it and forget it, main character energy. π
π DEFAULT π
blank
(it's giving empty. it's giving nothing. it's giving rejected email potential.) π
π§ PROTOCOLS π§
SMTP
that's the one. the only one. periodt. β
π₯ EXAMPLE π₯
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "president@example.com");
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
look at that. clean. correct. lowkey obsessed with it. π
π AVAILABILITY π
Added in 7.20.0 β a true elder, highkey iconic for its age. π
π RETURN VALUE π
- Returns
CURLE_OKif the option is supported β CURLE_UNKNOWN_OPTIONif it's not π¬- or
CURLE_OUT_OF_MEMORYif there was insufficient heap space π
pick your fighter, but hopefully it's the first one fr fr.
π«Ά SEE ALSO π«Ά
go read those too, they're the friend group. π¦
and that's the page, bestie! brought to you by libcurl 7.37.0, dated 19 Jun 2014 β a vintage moment, truly, and honestly? she ate. πβ¨
π¦ 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