Skip to content

Commit

Permalink
Multiple 'RCPT TO': Add help text for CLI argument into one more place.
Browse files Browse the repository at this point in the history
  • Loading branch information
volpav committed Jan 14, 2020
1 parent c344932 commit 9b7d78f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/cmdline-opts/mail-rcpt-ignore-invalid.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Long: mail-rcpt-ignore-invalid
Help: Ignore invalid "RCPT TO" addresses during SMTP conversation
Help: Ignore invalid recipient addresses during SMTP conversation
Protocols: SMTP
Added: 7.70.0
---
Expand Down
15 changes: 8 additions & 7 deletions lib/smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,32 +925,33 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode,
bool is_smtp_blocking_err =
is_smtp_err && !data->set.mail_rcpt_ignore_invalid;

if (is_smtp_err) {
if(is_smtp_err) {
/* Remembering the last failure which we can report if all "RCPT TO" have
failed and we cannot proceed. */
smtp->rcpt_last_error = smtpcode;

if (is_smtp_blocking_err) {
if(is_smtp_blocking_err) {
failf(data, "RCPT failed: %d", smtpcode);
result = CURLE_SEND_ERROR;
}
} else {
}
else {
/* Some "RCPT TO" have succeeded. */
smtp->rcpt_had_ok = TRUE;
}

if (!is_smtp_blocking_err) {
if(!is_smtp_blocking_err) {
smtp->rcpt = smtp->rcpt->next;

if(smtp->rcpt)
/* Send the next RCPT TO command */
result = smtp_perform_rcpt_to(conn);
else {
/* We weren't able to issue a successful "RCPT TO" command while going
over recipients (potentially multiple). Sending back the last error. */
if (!smtp->rcpt_had_ok) {
over recipients (potentially multiple). Sending back last error. */
if(!smtp->rcpt_had_ok) {
failf(data, "RCPT failed: %d (last error)", smtp->rcpt_last_error);
result = CURLE_SEND_ERROR;
result = CURLE_SEND_ERROR;
}
else {
/* Send the DATA command */
Expand Down
4 changes: 2 additions & 2 deletions lib/smtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ struct SMTP {
curl_pp_transfer transfer;
char *custom; /* Custom Request */
struct curl_slist *rcpt; /* Recipient list */
bool rcpt_had_ok; /* Whether any of the "RCPT TO" commands (depends on
a total number of recipients) succeeded so far */
bool rcpt_had_ok; /* Whether any of "RCPT TO" commands (depends on
total number of recipients) succeeded so far */
int rcpt_last_error; /* The last error received for "RCPT TO" command */
size_t eob; /* Number of bytes of the EOB (End Of Body) that
have been received so far */
Expand Down
2 changes: 2 additions & 0 deletions src/tool_help.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ static const struct helptxt helptext[] = {
"Mail from this address"},
{" --mail-rcpt <address>",
"Mail to this address"},
{" --mail-rcpt-ignore-invalid",
"Ignore invalid recipient addresses during SMTP conversation"},
{"-M, --manual",
"Display the full manual"},
{" --max-filesize <bytes>",
Expand Down

0 comments on commit 9b7d78f

Please sign in to comment.