CURLOPT_MAIL_FROM.md (1600B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_MAIL_FROM 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_MAIL_AUTH (3) 9 - CURLOPT_MAIL_RCPT (3) 10 Protocol: 11 - SMTP 12 Added-in: 7.20.0 13 --- 14 15 # NAME 16 17 CURLOPT_MAIL_FROM - SMTP sender address 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_FROM, char *from); 25 ~~~ 26 27 # DESCRIPTION 28 29 Pass a pointer to a null-terminated string as parameter. This should be used 30 to specify the sender's email address when sending SMTP mail with libcurl. 31 32 An originator email address should be specified with angled brackets (\<\>) 33 around it, which if not specified are added automatically. 34 35 If this parameter is not specified then an empty address is sent to the SMTP 36 server which might cause the email to be rejected. 37 38 The application does not have to keep the string around after setting this 39 option. 40 41 Using this option multiple times makes the last set string override the 42 previous ones. Set it to NULL to disable its use again. 43 44 # DEFAULT 45 46 blank 47 48 # %PROTOCOLS% 49 50 # EXAMPLE 51 52 ~~~c 53 int 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 70 curl_easy_setopt(3) returns a CURLcode indicating success or error. 71 72 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 73 libcurl-errors(3).