Propagate the error to the client if the external command fails (#40)

This change makes the external command code return a generic 554 error to the SMTP client if the external command fails, so it knows sending failed and can retry.
This commit is contained in:
Javi
2022-04-25 15:52:12 +02:00
committed by GitHub
parent 9c230182da
commit b134e426d7

View File

@@ -185,7 +185,7 @@ func mailHandler(peer smtpd.Peer, env smtpd.Envelope) error {
err := cmd.Run() err := cmd.Run()
if err != nil { if err != nil {
cmdLogger.WithError(err).Error(stderr.String()) cmdLogger.WithError(err).Error(stderr.String())
return nil return smtpd.Error{Code: 554, Message: "External command failed"}
} }
cmdLogger.Info("pipe command successful: " + stdout.String()) cmdLogger.Info("pipe command successful: " + stdout.String())