1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_MAIL_FROM 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_MAIL_AUTH (3) 9 - CURLOPT_MAIL_RCPT (3) 10Protocol: 11 - SMTP 12--- 13 14# NAME 15 16CURLOPT_MAIL_FROM - SMTP sender address 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_FROM, char *from); 24~~~ 25 26# DESCRIPTION 27 28Pass a pointer to a null-terminated string as parameter. This should be used 29to specify the sender's email address when sending SMTP mail with libcurl. 30 31An originator email address should be specified with angled brackets (\<\>) 32around it, which if not specified are added automatically. 33 34If this parameter is not specified then an empty address is sent to the SMTP 35server which might cause the email to be rejected. 36 37The application does not have to keep the string around after setting this 38option. 39 40# DEFAULT 41 42blank 43 44# EXAMPLE 45 46~~~c 47int main(void) 48{ 49 CURL *curl = curl_easy_init(); 50 if(curl) { 51 CURLcode res; 52 curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/"); 53 curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "president@example.com"); 54 res = curl_easy_perform(curl); 55 curl_easy_cleanup(curl); 56 } 57} 58~~~ 59 60# AVAILABILITY 61 62Added in 7.20.0 63 64# RETURN VALUE 65 66Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or 67CURLE_OUT_OF_MEMORY if there was insufficient heap space. 68