mirror of
https://github.com/decke/smtprelay.git
synced 2025-12-25 07:43:06 -07:00
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:
2
main.go
2
main.go
@@ -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())
|
||||||
|
|||||||
Reference in New Issue
Block a user