CURLOPT_MAIL_RCPT_ALLOWFAILS.md (1984B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_MAIL_RCPT_ALLOWFAILS 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: 8.2.0 13 --- 14 15 # NAME 16 17 CURLOPT_MAIL_RCPT_ALLOWFAILS - allow RCPT TO command to fail for some recipients 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT_ALLOWFAILS, 25 long allow); 26 ~~~ 27 28 # DESCRIPTION 29 30 If *allow* is set to 1L, allow RCPT TO command to fail for some recipients. 31 32 When sending data to multiple recipients, by default curl aborts the SMTP 33 conversation if either one of the recipients causes the RCPT TO command to 34 return an error. 35 36 The default behavior can be changed by setting *allow* to 1L which makes 37 libcurl ignore errors for individual recipients and proceed with the remaining 38 accepted recipients. 39 40 If all recipients trigger RCPT TO failures and this flag is specified, curl 41 aborts the SMTP conversation and returns the error received from to the last 42 RCPT TO command. 43 44 # DEFAULT 45 46 0 47 48 # %PROTOCOLS% 49 50 # EXAMPLE 51 52 ~~~c 53 int main(void) 54 { 55 CURL *curl = curl_easy_init(); 56 if(curl) { 57 struct curl_slist *list; 58 CURLcode res; 59 60 /* Adding one valid and one invalid email address */ 61 list = curl_slist_append(NULL, "person@example.com"); 62 list = curl_slist_append(list, "invalidemailaddress"); 63 64 curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/"); 65 curl_easy_setopt(curl, CURLOPT_MAIL_RCPT_ALLOWFAILS, 1L); 66 67 res = curl_easy_perform(curl); 68 curl_slist_free_all(list); 69 curl_easy_cleanup(curl); 70 } 71 } 72 ~~~ 73 74 # HISTORY 75 76 This option was called CURLOPT_MAIL_RCPT_ALLLOWFAILS (with three instead of 77 two letter L) before 8.2.0 78 79 # %AVAILABILITY% 80 81 # RETURN VALUE 82 83 curl_easy_setopt(3) returns a CURLcode indicating success or error. 84 85 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 86 libcurl-errors(3).