mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +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)
|
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.
|
// If error and it applies to all recipients, return a single error.
|
||||||
return deliverResult{err: inspectError(err)}
|
return deliverResult{err: inspectError(err)}
|
||||||
}
|
}
|
||||||
var ntodo []*msgResp
|
var ntodo []*msgResp
|
||||||
for i, mr := range todo[:n] {
|
for i, mr := range todo[:n] {
|
||||||
if err != nil {
|
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)
|
failed = append(failed, mr)
|
||||||
} else if i > 0 && (resps[i].Code == smtp.C452StorageFull || resps[i].Code == smtp.C552MailboxFull) {
|
} else if i > 0 && (resps[i].Code == smtp.C452StorageFull || resps[i].Code == smtp.C552MailboxFull) {
|
||||||
ntodo = append(ntodo, mr)
|
ntodo = append(ntodo, mr)
|
||||||
|
|
Loading…
Reference in a new issue