From 4a4609bf3c812afc65f700b4b7e673cc76ade1bf Mon Sep 17 00:00:00 2001 From: Pavel Volgarev Date: Tue, 14 Jan 2020 17:22:38 -0500 Subject: smtp: Allow RCPT TO command to fail for some recipients Introduces CURLOPT_MAIL_RCPT_ALLLOWFAILS. Verified with the new tests 3002-3007 Closes #4816 --- src/tool_cfgable.h | 3 ++- src/tool_getparam.c | 4 ++++ src/tool_help.c | 4 +++- src/tool_operate.c | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h index 32e811eaa..e093b2c84 100644 --- a/src/tool_cfgable.h +++ b/src/tool_cfgable.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , 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; diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 8df6e5e24..b757ac8f0 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -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; } diff --git a/src/tool_help.c b/src/tool_help.c index 8d3f34547..9ee99d174 100644 --- a/src/tool_help.c +++ b/src/tool_help.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , 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
", "Mail to this address"}, + {" --mail-rcpt-allowfails", + "Allow RCPT TO command to fail for some recipients"}, {"-M, --manual", "Display the full manual"}, {" --max-filesize ", diff --git a/src/tool_operate.c b/src/tool_operate.c index 2e6563a20..2855f0f8f 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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); -- cgit v1.2.3