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.
@@ -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())