feat: able to configure smtp from now (close #34)

This commit is contained in:
JustSong
2023-05-13 18:33:41 +08:00
parent dc4a6cb711
commit f5f4e6fbc6
4 changed files with 23 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ func InitOptionMap() {
common.OptionMap["TurnstileCheckEnabled"] = strconv.FormatBool(common.TurnstileCheckEnabled)
common.OptionMap["RegisterEnabled"] = strconv.FormatBool(common.RegisterEnabled)
common.OptionMap["SMTPServer"] = ""
common.OptionMap["SMTPFrom"] = ""
common.OptionMap["SMTPPort"] = strconv.Itoa(common.SMTPPort)
common.OptionMap["SMTPAccount"] = ""
common.OptionMap["SMTPToken"] = ""
@@ -58,6 +59,9 @@ func InitOptionMap() {
common.SysError("Failed to update option map: " + err.Error())
}
}
if common.SMTPFrom == "" { // for compatibility
common.SMTPFrom = common.SMTPAccount
}
}
func UpdateOption(key string, value string) error {
@@ -120,6 +124,8 @@ func updateOptionMap(key string, value string) (err error) {
common.SMTPPort = intValue
case "SMTPAccount":
common.SMTPAccount = value
case "SMTPFrom":
common.SMTPFrom = value
case "SMTPToken":
common.SMTPToken = value
case "ServerAddress":