Skip to content

Commit 1e759c6

Browse files
committed
Fix email template
1 parent b3c7f78 commit 1e759c6

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

server/email/email.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,7 @@ import (
99
gomail "gopkg.in/mail.v2"
1010
)
1111

12-
type Sender struct {
13-
User string
14-
Password string
15-
}
16-
17-
func NewSender() Sender {
18-
return Sender{User: constants.SMTP_USERNAME, Password: constants.SMTP_PASSWORD}
19-
}
20-
21-
func (sender Sender) SendMail(to []string, Subject, bodyMessage string) error {
12+
func SendMail(to []string, Subject, bodyMessage string) error {
2213
m := gomail.NewMessage()
2314
m.SetHeader("From", constants.SENDER_EMAIL)
2415
m.SetHeader("To", to...)

server/utils/email.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111

1212
// SendVerificationMail to send verification email
1313
func SendVerificationMail(toEmail, token string) error {
14-
sender := email.NewSender()
15-
1614
// The receiver needs to be in slice as the receive supports multiple receiver
1715
Receiver := []string{toEmail}
1816

@@ -74,7 +72,7 @@ func SendVerificationMail(toEmail, token string) error {
7472
<tr style="background: rgb(249,250,251);padding: 10px;margin-bottom:10px;border-radius:5px;">
7573
<td class="esd-block-text es-m-txt-c es-p15t" align="center" style="padding:10px;padding-bottom:30px;">
7674
<p>Hey there 👋</p>
77-
<p>We received a request to sign-up / login for <b>{{.OrgName}}</b>. If this is correct, please confirm your email address by clicking the button below.</p> <br/>
75+
<p>We have received request to verify email for <b>{{.OrgName}}</b>. If this is correct, please confirm your email address by clicking the button below.</p> <br/>
7876
<a
7977
clicktracking="off" href="{{.AuthUrl}}" class="es-button" target="_blank" style="text-decoration: none;padding:10px 15px;background-color: rgba(59,130,246,1);color: #fff;font-size: 1em;border-radius:5px;">Confirm Email</a>
8078
</td>
@@ -109,7 +107,7 @@ func SendVerificationMail(toEmail, token string) error {
109107
message = AddEmailTemplate(message, data, "verify_email.tmpl")
110108
// bodyMessage := sender.WriteHTMLEmail(Receiver, Subject, message)
111109

112-
return sender.SendMail(Receiver, Subject, message)
110+
return email.SendMail(Receiver, Subject, message)
113111
}
114112

115113
// SendForgotPasswordMail to send verification email
@@ -118,8 +116,6 @@ func SendForgotPasswordMail(toEmail, token, host string) error {
118116
constants.RESET_PASSWORD_URL = constants.AUTHORIZER_URL + "/app/reset-password"
119117
}
120118

121-
sender := email.NewSender()
122-
123119
// The receiver needs to be in slice as the receive supports multiple receiver
124120
Receiver := []string{toEmail}
125121

@@ -182,7 +178,7 @@ func SendForgotPasswordMail(toEmail, token, host string) error {
182178
<tr style="background: rgb(249,250,251);padding: 10px;margin-bottom:10px;border-radius:5px;">
183179
<td class="esd-block-text es-m-txt-c es-p15t" align="center" style="padding:10px;padding-bottom:30px;">
184180
<p>Hey there 👋</p>
185-
<p>We received a request to reset password for email: <b>{{.ToEmail}}</b>. If this is correct, please reset the password clicking the button below.</p> <br/>
181+
<p>We have received a request to reset password for email: <b>{{.ToEmail}}</b>. If this is correct, please reset the password clicking the button below.</p> <br/>
186182
<a clicktracking="off" href="{{.AuthUrl}}" class="es-button" target="_blank" style="text-decoration: none;padding:10px 15px;background-color: rgba(59,130,246,1);color: #fff;font-size: 1em;border-radius:5px;">Reset Password</a>
187183
</td>
188184
</tr>
@@ -216,7 +212,7 @@ func SendForgotPasswordMail(toEmail, token, host string) error {
216212
data["AuthUrl"] = constants.RESET_PASSWORD_URL + "?token=" + token
217213
message = AddEmailTemplate(message, data, "reset_password_email.tmpl")
218214

219-
return sender.SendMail(Receiver, Subject, message)
215+
return email.SendMail(Receiver, Subject, message)
220216
}
221217

222218
func AddEmailTemplate(a string, b map[string]interface{}, templateName string) string {

0 commit comments

Comments
 (0)