Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
@@ -222,7 +222,7 @@ func RenderEmailTemplate(templateName, companyName, confirmationLink, senderName
|
||||
}
|
||||
|
||||
var result bytes.Buffer
|
||||
result.Write([]byte("MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n"))
|
||||
// result.Write([]byte("MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n"))
|
||||
err := tpls.ExecuteTemplate(&result, templateName, data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
@@ -28,10 +28,41 @@ func TestEmailSend(t *testing.T) {
|
||||
|
||||
auth := smtp.PlainAuth("", "support@fusenpack.com", "wfbjpdgvaozjvwah", smtpServer)
|
||||
|
||||
subject := "Subject: Test email from Go!\n"
|
||||
mime := "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n"
|
||||
body := "<html><body><h1>Hello World!</h1></body></html>"
|
||||
msg := []byte(subject + mime + body)
|
||||
msg := []byte(`Subject: Password Reset Request for Your Account;
|
||||
MIME-version: 1.0;
|
||||
Content-Type: text/html; charset="UTF-8";
|
||||
From: "Fusen";
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Password Reset for Your {{.CompanyName}} Account</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Dear {{.UserName}},</p>
|
||||
|
||||
<p>We have received your request to reset the password for your {{.CompanyName}} account.</p>
|
||||
|
||||
<p>To proceed with the password reset, please click the button below to open the Reset Password page:</p>
|
||||
|
||||
<div style="margin: 1em 0;">
|
||||
<a href="{{.ConfirmationLink}}" target="_blank"
|
||||
style="background-color: #008CBA; color: #FFFFFF; text-decoration: none; padding: 10px 15px; border-radius: 3px; display:inline-block;">
|
||||
Reset Password
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p>Please note that this password reset confirmation link will expire in 60 minutes. If you have any further questions, feel free to reach out to us.</p>
|
||||
|
||||
<p>Regards,</p>
|
||||
|
||||
<p>{{.SenderName}}<br>
|
||||
{{.SenderTitle}}<br>
|
||||
{{.CompanyName}}</p>
|
||||
|
||||
</body>
|
||||
</html>`)
|
||||
|
||||
// 发送邮件
|
||||
err := smtp.SendMail(smtpServer+":587", auth, from, to, msg)
|
||||
|
||||
Reference in New Issue
Block a user