summaryrefslogtreecommitdiffstats
path: root/utils/mail.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-07-12 23:36:52 -0800
committer=Corey Hulen <corey@hulen.com>2015-07-12 23:36:52 -0800
commit252d0f3924dd19aa4dd1900c6c00c41c84755d1e (patch)
tree3d761e220c5e32aafedb7c17b198ec8215aec6d4 /utils/mail.go
parent27cab0f507d253bba5658335f42a4c7675fcdac7 (diff)
downloadchat-252d0f3924dd19aa4dd1900c6c00c41c84755d1e.tar.gz
chat-252d0f3924dd19aa4dd1900c6c00c41c84755d1e.tar.bz2
chat-252d0f3924dd19aa4dd1900c6c00c41c84755d1e.zip
Fixes mm-1415 adding email bypass flag
Diffstat (limited to 'utils/mail.go')
-rw-r--r--utils/mail.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/utils/mail.go b/utils/mail.go
index 3cd37ffef..0fe7042b7 100644
--- a/utils/mail.go
+++ b/utils/mail.go
@@ -8,14 +8,14 @@ import (
"crypto/tls"
"fmt"
"github.com/mattermost/platform/model"
+ "html"
"net"
"net/mail"
"net/smtp"
- "html"
)
func CheckMailSettings() *model.AppError {
- if len(Cfg.EmailSettings.SMTPServer) == 0 {
+ if len(Cfg.EmailSettings.SMTPServer) == 0 || Cfg.EmailSettings.ByPassEmail {
return model.NewAppError("CheckMailSettings", "No email settings present, mail will not be sent", "")
}
conn, err := connectToSMTPServer()
@@ -79,6 +79,10 @@ func newSMTPClient(conn net.Conn) (*smtp.Client, *model.AppError) {
func SendMail(to, subject, body string) *model.AppError {
+ if len(Cfg.EmailSettings.SMTPServer) == 0 || Cfg.EmailSettings.ByPassEmail {
+ return nil
+ }
+
fromMail := mail.Address{"", Cfg.EmailSettings.FeedbackEmail}
toMail := mail.Address{"", to}
@@ -95,11 +99,6 @@ func SendMail(to, subject, body string) *model.AppError {
}
message += "\r\n<html><body>" + body + "</body></html>"
- if len(Cfg.EmailSettings.SMTPServer) == 0 {
- l4g.Warn("Skipping sending of email because EmailSettings are not configured")
- return nil
- }
-
conn, err1 := connectToSMTPServer()
if err1 != nil {
return err1