From 9ed1ad195ade319f6789eba8f8db7665d6d991ea Mon Sep 17 00:00:00 2001 From: raphael10241024 <1206203935@qq.com> Date: Thu, 22 Dec 2016 16:45:51 +0800 Subject: [PATCH] fix bug #1122 log.smtp receiver configure error (#3602) --- conf/app.ini | 2 +- modules/setting/setting.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.ini b/conf/app.ini index 18ad9c3d215d2..1814c7516be28 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -336,7 +336,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 d78b22c484897..0e45c6b654aec 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -685,11 +685,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,