CURLOPT_MAIL_AUTH.md (2022B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_MAIL_AUTH 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_MAIL_FROM (3) 9 - CURLOPT_MAIL_RCPT (3) 10 Protocol: 11 - SMTP 12 Added-in: 7.25.0 13 --- 14 15 # NAME 16 17 CURLOPT_MAIL_AUTH - SMTP authentication address 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_AUTH, char *auth); 25 ~~~ 26 27 # DESCRIPTION 28 29 Pass a pointer to a null-terminated string as parameter. This is used to 30 specify the authentication address (identity) of a submitted message that is 31 being relayed to another server. 32 33 This optional parameter allows co-operating agents in a trusted environment to 34 communicate the authentication of individual messages and should only be used 35 by the application program, using libcurl, if the application is itself a mail 36 server acting in such an environment. If the application is operating as such 37 and the AUTH address is not known or is invalid, then an empty string should 38 be used for this parameter. 39 40 Unlike CURLOPT_MAIL_FROM(3) and CURLOPT_MAIL_RCPT(3), the address should not 41 be specified within a pair of angled brackets (\<\>). However, if an empty 42 string is used then a pair of brackets are sent by libcurl as required by RFC 43 2554. 44 45 The application does not have to keep the string around after setting this 46 option. 47 48 Using this option multiple times makes the last set string override the 49 previous ones. Set it to NULL to disable its use again. 50 51 # DEFAULT 52 53 NULL 54 55 # %PROTOCOLS% 56 57 # EXAMPLE 58 59 ~~~c 60 int main(void) 61 { 62 CURL *curl = curl_easy_init(); 63 if(curl) { 64 CURLcode res; 65 curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/"); 66 curl_easy_setopt(curl, CURLOPT_MAIL_AUTH, "<secret@cave>"); 67 res = curl_easy_perform(curl); 68 curl_easy_cleanup(curl); 69 } 70 } 71 ~~~ 72 73 # %AVAILABILITY% 74 75 # RETURN VALUE 76 77 curl_easy_setopt(3) returns a CURLcode indicating success or error. 78 79 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 80 libcurl-errors(3).