smtp: Allow RCPT TO command to fail for some recipients

Introduces CURLOPT_MAIL_RCPT_ALLLOWFAILS.

Verified with the new tests 3002-3007

Closes #4816
This commit is contained in:
Pavel Volgarev 2020-01-14 17:22:38 -05:00 committed by Daniel Stenberg
parent 23a17e039d
commit 4a4609bf3c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
22 changed files with 483 additions and 26 deletions

View file

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -108,6 +108,7 @@ struct OperationConfig {
char *mail_from;
struct curl_slist *mail_rcpt;
char *mail_auth;
bool mail_rcpt_allowfails; /* --mail-rcpt-allowfails */
char *sasl_authzid; /* Authorisation identity (identity to use) */
bool sasl_ir; /* Enable/disable SASL initial response */
bool proxytunnel;

View file

@ -273,6 +273,7 @@ static const struct LongShort aliases[]= {
{"f", "fail", ARG_BOOL},
{"fa", "fail-early", ARG_BOOL},
{"fb", "styled-output", ARG_BOOL},
{"fc", "mail-rcpt-allowfails", ARG_BOOL},
{"F", "form", ARG_STRING},
{"Fs", "form-string", ARG_STRING},
{"g", "globoff", ARG_BOOL},
@ -1722,6 +1723,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
case 'b': /* --styled-output */
global->styled_output = toggle;
break;
case 'c': /* --mail-rcpt-allowfails */
config->mail_rcpt_allowfails = toggle;
break;
default: /* --fail (hard on errors) */
config->failonerror = toggle;
}

View file

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -239,6 +239,8 @@ static const struct helptxt helptext[] = {
"Mail from this address"},
{" --mail-rcpt <address>",
"Mail to this address"},
{" --mail-rcpt-allowfails",
"Allow RCPT TO command to fail for some recipients"},
{"-M, --manual",
"Display the full manual"},
{" --max-filesize <bytes>",

View file

@ -1835,6 +1835,10 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(config->mail_rcpt)
my_setopt_slist(curl, CURLOPT_MAIL_RCPT, config->mail_rcpt);
/* curl 7.69.x */
my_setopt(curl, CURLOPT_MAIL_RCPT_ALLLOWFAILS,
config->mail_rcpt_allowfails ? 1L : 0L);
/* curl 7.20.x */
if(config->ftp_pret)
my_setopt(curl, CURLOPT_FTP_USE_PRET, 1L);