From b134e426d78405a31150ae056e68046715edb4fd Mon Sep 17 00:00:00 2001 From: Javi Date: Mon, 25 Apr 2022 15:52:12 +0200 Subject: [PATCH] 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. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 1a815e2..9c409f6 100644 --- a/main.go +++ b/main.go @@ -185,7 +185,7 @@ func mailHandler(peer smtpd.Peer, env smtpd.Envelope) error { err := cmd.Run() if err != nil { cmdLogger.WithError(err).Error(stderr.String()) - return nil + return smtpd.Error{Code: 554, Message: "External command failed"} } cmdLogger.Info("pipe command successful: " + stdout.String())