diff --git a/.gitignore b/.gitignore index 882f4c09aeb..96824b93aa3 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,4 @@ public/css/*.min.css conf/custom.ini fig.yml profile.cov - +grafana diff --git a/pkg/services/notifications/notifications.go b/pkg/services/notifications/notifications.go index 3d2c95b7c23..576fe828331 100644 --- a/pkg/services/notifications/notifications.go +++ b/pkg/services/notifications/notifications.go @@ -19,6 +19,7 @@ import ( var mailTemplates *template.Template var tmplResetPassword = "reset_password.html" var tmplSignUpStarted = "signup_started.html" +var tmplWelcomeOnSignUp = "welcome_on_signup.html" func Init() error { initMailQueue() @@ -28,6 +29,7 @@ func Init() error { bus.AddHandler("email", sendEmailCommandHandler) bus.AddEventListener(signUpStartedHandler) + bus.AddEventListener(signUpCompletedHandler) mailTemplates = template.New("name") mailTemplates.Funcs(template.FuncMap{ @@ -143,3 +145,17 @@ func signUpStartedHandler(evt *events.SignUpStarted) error { }, }) } + +func signUpCompletedHandler(evt *events.SignUpCompleted) error { + if evt.Email == "" || !setting.Smtp.SendWelcomeEmailOnSignUp { + return nil + } + + return sendEmailCommandHandler(&m.SendEmailCommand{ + To: []string{evt.Email}, + Template: tmplSignUpStarted, + Data: map[string]interface{}{ + "Name": evt.Name, + }, + }) +}