Add a 'KeepRejects' option that disables auto-cleanup (#49)

Add a 'KeepRejects' option that disables auto cleanup of the rejects mailbox.
This commit is contained in:
bobobo1618
2023-07-23 17:03:09 +02:00
committed by GitHub
parent e943e0c65d
commit 671fc5b8f1
3 changed files with 11 additions and 1 deletions

View File

@ -2418,7 +2418,12 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
m.MessageID = messageid
m.MessageHash = messagehash
acc.WithWLock(func() {
if hasSpace, err := acc.TidyRejectsMailbox(c.log, conf.RejectsMailbox); err != nil {
hasSpace := true
var err error
if !conf.KeepRejects {
hasSpace, err = acc.TidyRejectsMailbox(c.log, conf.RejectsMailbox)
}
if err != nil {
log.Errorx("tidying rejects mailbox", err)
} else if hasSpace {
if err := acc.DeliverMailbox(log, conf.RejectsMailbox, m, dataFile, false); err != nil {