mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
smtpsrv: Failures to enqueue are transient, not permanent
If we fail to put the message in the queue (e.g. because we're out of storage space, or the aliases-resolve hook errored out), it should be considered a transient failure. Currently we return a permanent error, which is misleading, as we want clients to retry in these situations. So this patch changes the error returned accordingly.
This commit is contained in:
@@ -604,9 +604,10 @@ func (c *Conn) DATA(params string) (code int, msg string) {
|
|||||||
|
|
||||||
// There are no partial failures here: we put it in the queue, and then if
|
// There are no partial failures here: we put it in the queue, and then if
|
||||||
// individual deliveries fail, we report via email.
|
// individual deliveries fail, we report via email.
|
||||||
|
// If we fail to queue, return a transient error.
|
||||||
msgID, err := c.queue.Put(c.mailFrom, c.rcptTo, c.data)
|
msgID, err := c.queue.Put(c.mailFrom, c.rcptTo, c.data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 554, fmt.Sprintf("5.3.0 Failed to queue message: %v", err)
|
return 451, fmt.Sprintf("4.3.0 Failed to queue message: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.tr.Printf("Queued from %s to %s - %s", c.mailFrom, c.rcptTo, msgID)
|
c.tr.Printf("Queued from %s to %s - %s", c.mailFrom, c.rcptTo, msgID)
|
||||||
|
|||||||
Reference in New Issue
Block a user