1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_MAIL_RCPT_ALLOWFAILS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_MAIL_FROM (3)
9  - CURLOPT_MAIL_RCPT (3)
10Protocol:
11  - SMTP
12Added-in: 8.2.0
13---
14
15# NAME
16
17CURLOPT_MAIL_RCPT_ALLOWFAILS - allow RCPT TO command to fail for some recipients
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT_ALLOWFAILS,
25                          long allow);
26~~~
27
28# DESCRIPTION
29
30If *allow* is set to 1L, allow RCPT TO command to fail for some recipients.
31
32When sending data to multiple recipients, by default curl aborts the SMTP
33conversation if either one of the recipients causes the RCPT TO command to
34return an error.
35
36The default behavior can be changed by setting *allow* to 1L which makes
37libcurl ignore errors for individual recipients and proceed with the remaining
38accepted recipients.
39
40If all recipients trigger RCPT TO failures and this flag is specified, curl
41aborts the SMTP conversation and returns the error received from to the last
42RCPT TO command.
43
44# DEFAULT
45
460
47
48# %PROTOCOLS%
49
50# EXAMPLE
51
52~~~c
53int 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
76This option was called CURLOPT_MAIL_RCPT_ALLLOWFAILS (with three instead of
77two letter L) before 8.2.0
78
79# %AVAILABILITY%
80
81# RETURN VALUE
82
83Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
84