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