Browse Source

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.
Javi 3 years ago
parent
commit
b134e426d7
1 changed files with 1 additions and 1 deletions
  1. 1 1
      main.go

+ 1 - 1
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())