This commit is contained in:
2023-09-06 00:06:10 +08:00
parent 33a3c22b69
commit 7bf4c238c2
3 changed files with 55 additions and 10 deletions

View File

@@ -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)