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

View File

@ -1,5 +1,11 @@
Subject: Please confirm your {{ .CompanyName }} account
Subject: Please confirm your {{ .CompanyName }} account;
MIME-version: 1.0;
Content-Type: text/html; charset="UTF-8";
From: "Fusen Support";
<html>
<body>
Dear {{ .UserName }},
Thank you for registering an account with {{ .CompanyName }}. We are thrilled to have you join our community!
@ -8,7 +14,6 @@ Please take a moment to confirm your email address by clicking the button below
<a href="{{ .ConfirmationLink }}" target="_blank" style="background-color: #008CBA; color: #FFFFFF; text-decoration: none; padding: 10px 15px; border-radius: 3px; display:inline-block; font-weight: bold;">Confirm Account: {{ .UserName }}</a>
Confirming your email ensures your account is properly secured. This also lets you access member-only tools and content.
If you did not register for {{ .CompanyName }}, please disregard this email. Let us know if you have any other questions!
@ -17,4 +22,6 @@ Regards,
{{ .SenderName }}
{{ .SenderTitle }}
{{ .CompanyName }}
{{ .CompanyName }}
<body>
<html>

View File

@ -1,5 +1,10 @@
Subject: Password Reset Request for Your {{ .CompanyName }} Account
MIME-version: 1.0;
Content-Type: text/html; charset="UTF-8";
From: "Fusen Support";
<html>
<body>
Dear {{ .UserName }},
We have received your request to reset the password for your {{ .CompanyName }} account.
@ -16,6 +21,8 @@ To proceed with the password reset, please click the button below to open the Re
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.
Regards,
{{ .SenderName }}<br>
{{ .SenderTitle }}<br>
{{ .CompanyName }}
{{ .SenderName }}
{{ .SenderTitle }}
{{ .CompanyName }}
<body>
<html>

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)