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