• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.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)
10---
11
12# NAME
13
14CURLOPT_MAIL_RCPT_ALLOWFAILS - allow RCPT TO command to fail for some recipients
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT_ALLOWFAILS,
22                          long allow);
23~~~
24
25# DESCRIPTION
26
27If *allow* is set to 1L, allow RCPT TO command to fail for some recipients.
28
29When sending data to multiple recipients, by default curl aborts the SMTP
30conversation if either one of the recipients causes the RCPT TO command to
31return an error.
32
33The default behavior can be changed by setting *allow* to 1L which makes
34libcurl ignore errors for individual recipients and proceed with the remaining
35accepted recipients.
36
37If all recipients trigger RCPT TO failures and this flag is specified, curl
38aborts the SMTP conversation and returns the error received from to the last
39RCPT TO command.
40
41# DEFAULT
42
430
44
45# PROTOCOLS
46
47SMTP
48
49# EXAMPLE
50
51~~~c
52int main(void)
53{
54  CURL *curl = curl_easy_init();
55  if(curl) {
56    struct curl_slist *list;
57    CURLcode res;
58
59    /* Adding one valid and one invalid email address */
60    list = curl_slist_append(NULL, "person@example.com");
61    list = curl_slist_append(list, "invalidemailaddress");
62
63    curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
64    curl_easy_setopt(curl, CURLOPT_MAIL_RCPT_ALLOWFAILS, 1L);
65
66    res = curl_easy_perform(curl);
67    curl_slist_free_all(list);
68    curl_easy_cleanup(curl);
69  }
70}
71~~~
72
73# AVAILABILITY
74
75This option was called CURLOPT_MAIL_RCPT_ALLLOWFAILS before 8.2.0
76
77Added in 7.69.0.
78
79# RETURN VALUE
80
81Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
82