CURLOPT_MAIL_FROM(3)
π CURLOPT_MAIL_FROM(3) β Library Functions Manual, but make it cute β¨
π NAME π
CURLOPT_MAIL_FROM β SMTP sender address π
β¨ SYNOPSIS β¨
okay bestie, include the header and call it like this:
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_FROM, char *from);
π¦ DESCRIPTION π¦
So this is the option where you pass a pointer to a null-terminated string as the parameter. It should be used to specify the sender's email address when sending SMTP mail with libcurl. π
An originator email address should be specified with angled brackets (<>) around it β and if you don't specify them, they get added automatically. no cap, libcurl handles the glow-up for you β¨
In order to specify DSN parameters (as per RFC 3461), the address has to be written in angled brackets, followed by the parameters. iykyk π«Ά
If this parameter is not specified then an empty address is sent to the SMTP server, which might cause the email to be rejected. π literally not the vibe.
The application does not have to keep the string around after setting this option. so you can let it go, bestie π
Using this option multiple times makes the last set string override the previous ones. Set it to NULL to disable its use again. periodt π
π DEFAULT π
blank β literally blank, bestie.
π PROTOCOLS π
This functionality affects smtp only.
π EXAMPLE π
here's the whole vibe in C:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "president@example.com");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
π¦ AVAILABILITY π¦
Added in curl 7.20.0.
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK. non-zero means an error occurred β see libcurl-errors(3) for the tea β
π₯ SEE ALSO π₯
okay that's the whole page, bestie π«Ά source/version: libcurl, date: 2026-10-12, page: CURLOPT_MAIL_FROM(3) β mwah πβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms