diff options
author | Eduardo Chappa <chappa@washington.edu> | 2018-12-08 23:56:28 -0700 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2018-12-08 23:56:28 -0700 |
commit | e41a0aae6dc5bf8190d3f2bb077af93aea157d4c (patch) | |
tree | 9e219e4c5c0e52f0eea36a8f13365c2f0a5ae21b /imap/src | |
parent | ac4c41f00814a6c91d7fb440e2e3339f14ffd638 (diff) | |
download | alpine-e41a0aae6dc5bf8190d3f2bb077af93aea157d4c.tar.xz |
* Let the client do a RSET when an error occurs while sending an
email via SMTP, but still report the previous error to the client.
Diffstat (limited to 'imap/src')
-rw-r--r-- | imap/src/c-client/smtp.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/imap/src/c-client/smtp.c b/imap/src/c-client/smtp.c index d6b46a56..d614ef97 100644 --- a/imap/src/c-client/smtp.c +++ b/imap/src/c-client/smtp.c @@ -417,8 +417,8 @@ SENDSTREAM *smtp_close (SENDSTREAM *stream) long smtp_mail (SENDSTREAM *stream,char *type,ENVELOPE *env,BODY *body) { RFC822BUFFER buf; - char tmp[SENDBUFLEN+1], smtpserver[SENDBUFLEN+1]; - long error = NIL; + char tmp[SENDBUFLEN+1], smtpserver[SENDBUFLEN+1], *error_string; + long error = NIL, i; long retry = NIL; buf.f = smtp_soutr; /* initialize buffer */ buf.s = stream->netstream; @@ -478,7 +478,7 @@ long smtp_mail (SENDSTREAM *stream,char *type,ENVELOPE *env,BODY *body) } } /* send "MAIL FROM" command */ - switch (smtp_send (stream,type,tmp)) { + switch (i = smtp_send (stream,type,tmp)) { case SMTPUNAVAIL: /* mailbox unavailable? */ case SMTPWANTAUTH: /* wants authentication? */ case SMTPWANTAUTH2: @@ -486,12 +486,12 @@ long smtp_mail (SENDSTREAM *stream,char *type,ENVELOPE *env,BODY *body) case SMTPOK: /* looks good */ break; default: /* other failure */ - /* Do not RSET connection at this time, or else client - * will not see failure, and will see the reply to a - * RSET command, which is typically success, and not the - * error that made us come here, in the first place. - * smtp_send (stream,"RSET",NIL); - */ + error_string = stream && stream->reply ? cpystr(stream->reply) : NIL; + smtp_send (stream,"RSET",NIL); + if(error_string){ /* report it */ + smtp_seterror(stream, i, error_string); + fs_give((void **) &error_string); + } return NIL; } /* negotiate the recipients */ |