summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-06-16 23:05:37 -0800
committer=Corey Hulen <corey@hulen.com>2015-06-16 23:05:37 -0800
commitb41925da310aa717fb6100fcc498adc8f3176c30 (patch)
treea9a1fdc156b429d9ecf027fa82419b242b5b08c6
parent7d14343634aa0cc8b3990f806d1d3c9ed214e140 (diff)
downloadchat-b41925da310aa717fb6100fcc498adc8f3176c30.tar.gz
chat-b41925da310aa717fb6100fcc498adc8f3176c30.tar.bz2
chat-b41925da310aa717fb6100fcc498adc8f3176c30.zip
Fixing build
-rw-r--r--config/config.json2
-rw-r--r--utils/mail.go16
2 files changed, 11 insertions, 7 deletions
diff --git a/config/config.json b/config/config.json
index 80431c9de..3d2c26716 100644
--- a/config/config.json
+++ b/config/config.json
@@ -10,7 +10,7 @@
"ServiceSettings": {
"SiteName": "Mattermost Preview",
"Domain": "",
- "Mode" : "prod",
+ "Mode" : "dev",
"AllowTesting" : false,
"UseSSL": false,
"Port": "8065",
diff --git a/utils/mail.go b/utils/mail.go
index 645dcae24..bf1cc9d46 100644
--- a/utils/mail.go
+++ b/utils/mail.go
@@ -40,23 +40,27 @@ func SendMail(to, subject, body string) *model.AppError {
auth := smtp.PlainAuth("", Cfg.EmailSettings.SMTPUsername, Cfg.EmailSettings.SMTPPassword, host)
+ var conn net.Conn
+ var err error
+
if Cfg.EmailSettings.UseTLS {
tlsconfig := &tls.Config{
InsecureSkipVerify: true,
ServerName: host,
}
- conn, err := tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig)
+ conn, err = tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig)
if err != nil {
return model.NewAppError("SendMail", "Failed to open TLS connection", err.Error())
}
- defer conn.Close()
+ } else {
+ conn, err = net.Dial("tcp", Cfg.EmailSettings.SMTPServer)
+ if err != nil {
+ return model.NewAppError("SendMail", "Failed to open connection", err.Error())
+ }
}
- conn, err := net.Dial("tcp", Cfg.EmailSettings.SMTPServer)
- if err != nil {
- return model.NewAppError("SendMail", "Failed to open connection", err.Error())
- }
+ defer conn.Close()
c, err := smtp.NewClient(conn, host)
if err != nil {