CURLOPT_MAIL_RCPT_ALLLOWFAILS(3)

πŸ“¦
version 7.88.1 Β· 3 versions
, in debian bookworm

✨ CURLOPT_MAIL_RCPT_ALLLOWFAILS ✨

okay bestie so this is a curl_easy_setopt option, it lives in the curl_easy_setopt options manual fam, and yes the name has three whole L's in ALLLOWFAILS β€” that's not a typo, that's just how it is, we don't question it, we respect it πŸ’…


🌸 NAME 🌸

CURLOPT_MAIL_RCPT_ALLLOWFAILS β€” let the RCPT TO command fail for some recipients and not have the whole thing blow up 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT_ALLLOWFAILS,
                          long allow);

πŸ¦‹ DESCRIPTION πŸ¦‹

So if allow is set to 1L, you're telling curl: yeah, let the RCPT TO command fail for some recipients, it's fine, we're chill like that.

Here's the tea though πŸ“ β€” when you're sending data to multiple recipients, curl's default vibe is very much "one of you messes up, everybody's going home." Like, if even one recipient makes RCPT TO return an error, curl just aborts the whole SMTP conversation. Not very demure, but that's the default.

You can switch up that default behavior by setting ignore to 1L, which makes curl ignore the errors and just keep going with the remaining valid recipients. main character energy honestly πŸ‘‘

⚠️ but bestie, listen β€” if ALL the recipients trigger RCPT TO failures and you've specified this flag? curl will still abort the SMTP conversation and return the error received from to the last RCPT TO command. So like, no saving you if literally everyone flops 😭

πŸ’œ DEFAULT πŸ’œ

0


🌈 PROTOCOLS 🌈

SMTP


🧚 EXAMPLE 🧚

CURL *curl = curl_easy_init();
if(curl) {
  struct curl_slist *list;

  /* Adding one valid and one invalid email address */
  list = curl_slist_append(NULL, "person@example.com");
  list = curl_slist_append(list, "invalidemailaddress");

  curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
  curl_easy_setopt(curl, CURLOPT_MAIL_RCPT_ALLLOWFAILS, 1L);

  ret = curl_easy_perform(curl);
  curl_slist_free_all(list);
  curl_easy_cleanup(curl);
}

one valid email, one absolute mess of an email, and curl's just gonna keep it moving πŸ’–βœ¨


⭐ AVAILABILITY ⭐

Added in 7.69.0. she's been around, she's established, she's an icon πŸŽ€


πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. simple as that, no cap πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘


mwah, that's the whole page πŸ’œ this is from libcurl 7.88.1, dated January 02, 2023 β€” go forth and send your emails, bestie, and remember: one bad recipient does not have to ruin the whole party πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from