Improved error message when -email-from is empty while sending mail

This commit is contained in:
ned3y2k 2022-03-24 22:02:12 +09:00
parent 360ae9e4b9
commit d6e674bcf6
2 changed files with 30 additions and 0 deletions

View file

@ -275,6 +275,12 @@ func EmailClient(db store.IStore, mailer emailer.Emailer, emailSubject, emailCon
)
if err != nil {
_, isMailError := err.(emailer.SmtpMailError)
if isMailError {
fmt.Println("SmtpMailError", err)
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "An error occurred while sending mail. Contact your administrator."})
}
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, err.Error()})
}