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