mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-07 06:57:37 +03:00
queue: Make use of exterrors
This commit is contained in:
parent
c8038167e9
commit
1a2d2036ca
2 changed files with 4 additions and 31 deletions
|
@ -29,6 +29,7 @@ import (
|
|||
modconfig "github.com/foxcpp/maddy/config/module"
|
||||
"github.com/foxcpp/maddy/dispatcher"
|
||||
"github.com/foxcpp/maddy/dsn"
|
||||
"github.com/foxcpp/maddy/exterrors"
|
||||
"github.com/foxcpp/maddy/log"
|
||||
"github.com/foxcpp/maddy/module"
|
||||
"github.com/foxcpp/maddy/target"
|
||||
|
@ -235,7 +236,7 @@ func (q *Queue) tryDelivery(meta *QueueMetadata, header textproto.Header, body b
|
|||
EnhancedCode: smtp.EnhancedCode{5, 0, 0},
|
||||
Message: rcptErr.Error(),
|
||||
}
|
||||
if target.IsTemporaryErr(rcptErr) {
|
||||
if exterrors.IsTemporaryOrUnspec(rcptErr) {
|
||||
smtpErr.Code = 451
|
||||
smtpErr.EnhancedCode = smtp.EnhancedCode{4, 0, 0}
|
||||
}
|
||||
|
@ -297,7 +298,7 @@ func (q *Queue) deliver(meta *QueueMetadata, header textproto.Header, body buffe
|
|||
var acceptedRcpts []string
|
||||
for _, rcpt := range meta.To {
|
||||
if err := delivery.AddRcpt(rcpt); err != nil {
|
||||
if target.IsTemporaryErr(err) {
|
||||
if exterrors.IsTemporaryOrUnspec(err) {
|
||||
perr.TemporaryFailed = append(perr.TemporaryFailed, rcpt)
|
||||
} else {
|
||||
perr.Failed = append(perr.Failed, rcpt)
|
||||
|
@ -323,7 +324,7 @@ func (q *Queue) deliver(meta *QueueMetadata, header textproto.Header, body buffe
|
|||
perr.Errs[rcpt] = rcptErr
|
||||
}
|
||||
} else {
|
||||
if target.IsTemporaryErr(err) {
|
||||
if exterrors.IsTemporaryOrUnspec(err) {
|
||||
perr.TemporaryFailed = append(perr.TemporaryFailed, acceptedRcpts...)
|
||||
} else {
|
||||
perr.Failed = append(perr.Failed, acceptedRcpts...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue