summaryrefslogtreecommitdiffstats
path: root/utils/mail.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-07-21 12:26:27 -0800
committer=Corey Hulen <corey@hulen.com>2015-07-21 12:26:27 -0800
commit848eeeeef4ed277ceb00d3fc6c8a0303c0e72d09 (patch)
tree98390442e8052b8e02469e5ccf7596e22b7ea07f /utils/mail.go
parente87adce4a059b97a65198b326be6304abdf4e657 (diff)
parentbee26e3f2654ce7acce647818847480569236343 (diff)
downloadchat-848eeeeef4ed277ceb00d3fc6c8a0303c0e72d09.tar.gz
chat-848eeeeef4ed277ceb00d3fc6c8a0303c0e72d09.tar.bz2
chat-848eeeeef4ed277ceb00d3fc6c8a0303c0e72d09.zip
fixing merge conflicts
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