This commit is contained in:
eson 2023-09-04 10:50:21 +08:00
parent 9c89f0fe4a
commit 9c013ac494
3 changed files with 46 additions and 22 deletions

View File

@ -0,0 +1,19 @@
Subject: Please confirm your {{.CompanyName}} account
Dear ,
Thank you for registering an account with {{.CompanyName}}. We are thrilled to have you join our community!
Please take a moment to confirm your email address by clicking the button below so we can activate your account:
<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 My Account</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!
Regards,
{{.SenderName}}
{{.SenderTitle}}
{{.CompanyName}}

View File

@ -1,7 +1,31 @@
package main
import "testing"
import (
"testing"
)
const emailTemplate = `Subject: Please confirm your {{CompanyName}} account
Dear ,
Thank you for registering an account with {{CompanyName}}. We are thrilled to have you join our community!
Please take a moment to confirm your email address by clicking the button below so we can activate your account:
<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 My Account</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!
Regards,
{{SenderName}}
{{SenderTitle}}
{{CompanyName}}
`
func TestMain(t *testing.T) {
main()
}

View File

@ -147,28 +147,9 @@ func (m *EmailSender) ClearExpiredTasks() {
}
}
const emailTemplate = `Subject: Your {{.CompanyName}} Account Confirmation
Dear
Thank you for creating an account with {{.CompanyName}}. We're excited to have you on board!
Before we get started, we just need to confirm that this is the right email address. Please confirm your email address by clicking on the link below:
{{.ConfirmationLink}}
Once you've confirmed, you can get started with {{.CompanyName}}. If you have any questions, feel free to reply to this email. We're here to help!
If you did not create an account with us, please ignore this email.
Thanks,
{{.SenderName}}
{{.SenderTitle}}
{{.CompanyName}}
`
func RenderEmailTemplate(companyName, confirmationLink, senderName, senderTitle string) []byte {
tmpl, err := template.New("email").Parse(emailTemplate)
tmpl, err := template.New("email").ParseFiles("../../html_template/email_register.tpl")
if err != nil {
log.Fatal(err)
}