diff options
author | raphael10241024 <1206203935@qq.com> | 2016-12-22 16:45:51 +0800 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-12-22 03:45:51 -0500 |
commit | 0f8a5fdf49f712cf082c9b9c63ee660a9aa9c382 (patch) | |
tree | 182e980a115c3f2be727d057088187d077c528f7 | |
parent | 3c91c9063bbd7de114a5e67e4d0ee6db39da6d49 (diff) |
fix bug #1122 log.smtp receiver configure error (#3602)
-rw-r--r-- | conf/app.ini | 2 | ||||
-rw-r--r-- | modules/setting/setting.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/conf/app.ini b/conf/app.ini index 9f7f0f1d..61748027 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -338,7 +338,7 @@ HOST = ; Mailer user name and password USER = PASSWD = -; Receivers, can be one or more, e.g. ["1@example.com","2@example.com"] +; Receivers, can be one or more, e.g. 1@example.com,2@example.com RECEIVERS = ; For "database" mode only diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 42bbd349..7fa48642 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -671,11 +671,11 @@ func newLogService() { sec.Key("PROTOCOL").In("tcp", []string{"tcp", "unix", "udp"}), sec.Key("ADDR").MustString(":7020")) case "smtp": - LogConfigs[i] = fmt.Sprintf(`{"level":%s,"username":"%s","password":"%s","host":"%s","sendTos":"%s","subject":"%s"}`, level, + LogConfigs[i] = fmt.Sprintf(`{"level":%s,"username":"%s","password":"%s","host":"%s","sendTos":["%s"],"subject":"%s"}`, level, sec.Key("USER").MustString("example@example.com"), sec.Key("PASSWD").MustString("******"), sec.Key("HOST").MustString("127.0.0.1:25"), - sec.Key("RECEIVERS").MustString("[]"), + strings.Replace(sec.Key("RECEIVERS").MustString("example@example.com"), ",", "\",\"", -1), sec.Key("SUBJECT").MustString("Diagnostic message from serve")) case "database": LogConfigs[i] = fmt.Sprintf(`{"level":%s,"driver":"%s","conn":"%s"}`, level, |