mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-27 20:45:56 +00:00
smtp: Distinguish permanent errors
This patch makes the SMTP courier distinguish permanent errors, so the queue can decide whether to retry or not. It's based on the SMTP replies: 5xy is considerent permanent, anything else is transient (including errors other than protocol issues).
This commit is contained in:
@@ -107,21 +107,21 @@ retry:
|
||||
from = ""
|
||||
}
|
||||
if err = c.MailAndRcpt(from, to); err != nil {
|
||||
return tr.Errorf("MAIL+RCPT %v", err), false
|
||||
return tr.Errorf("MAIL+RCPT %v", err), smtp.IsPermanent(err)
|
||||
}
|
||||
|
||||
w, err := c.Data()
|
||||
if err != nil {
|
||||
return tr.Errorf("DATA %v", err), false
|
||||
return tr.Errorf("DATA %v", err), smtp.IsPermanent(err)
|
||||
}
|
||||
_, err = w.Write(data)
|
||||
if err != nil {
|
||||
return tr.Errorf("DATA writing: %v", err), false
|
||||
return tr.Errorf("DATA writing: %v", err), smtp.IsPermanent(err)
|
||||
}
|
||||
|
||||
err = w.Close()
|
||||
if err != nil {
|
||||
return tr.Errorf("DATA closing %v", err), false
|
||||
return tr.Errorf("DATA closing %v", err), smtp.IsPermanent(err)
|
||||
}
|
||||
|
||||
c.Quit()
|
||||
|
||||
Reference in New Issue
Block a user