mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
return smtp response/error correctly in more cases
This commit is contained in:
parent
4012b72d96
commit
12e6975aa7
1 changed files with 6 additions and 2 deletions
|
@ -708,14 +708,18 @@ func deliverHost(log mlog.Log, resolver dns.Resolver, dialer smtpclient.Dialer,
|
|||
}
|
||||
|
||||
resps, err := sc.DeliverMultiple(ctx, mailFrom, rcpts, size, msg, has8bit, smtputf8, m0.RequireTLS != nil && *m0.RequireTLS)
|
||||
if err != nil && len(resps) == len(msgResps) {
|
||||
if err != nil && (len(resps) == 0 && n == len(msgResps) || len(resps) == len(msgResps)) {
|
||||
// If error and it applies to all recipients, return a single error.
|
||||
return deliverResult{err: inspectError(err)}
|
||||
}
|
||||
var ntodo []*msgResp
|
||||
for i, mr := range todo[:n] {
|
||||
if err != nil {
|
||||
mr.resp = smtpclient.Response{Err: err}
|
||||
if cerr, ok := err.(smtpclient.Error); ok {
|
||||
mr.resp = smtpclient.Response(cerr)
|
||||
} else {
|
||||
mr.resp = smtpclient.Response{Err: err}
|
||||
}
|
||||
failed = append(failed, mr)
|
||||
} else if i > 0 && (resps[i].Code == smtp.C452StorageFull || resps[i].Code == smtp.C552MailboxFull) {
|
||||
ntodo = append(ntodo, mr)
|
||||
|
|
Loading…
Reference in a new issue