Skip to content

Commit

Permalink
Update root.go
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDev101 committed Aug 28, 2024
1 parent c56db60 commit b5ee197
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions pkg/api/v0/routes/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,20 +428,25 @@ func RootRouter(r chi.Router) {
return
}

// Send welcome email
if err := dm.SendHTMLEmail(&structs.EmailArgs{
Subject: "Welcome to CloudLink Omega!",
To: u.Email,
Template: "hello",
}, &structs.TemplateData{
Name: u.Username,
VerificationLink: fmt.Sprintf("%s/api/v0/verify?token=%s", dm.PublicHostname, verifLink),
UnsubscribeLink: fmt.Sprintf("%s/api/v0/unsubscribe?token=%s", dm.PublicHostname, verifLink),
}); err != nil {

// Log error
log.Printf("Failed to send welcome email: %s", err)

// Send welcome email - TODO: Somehow make this a template.
if err := dm.SendPlainEmail(&structs.EmailArgs{
Subject: "Please verify your email address",
To: u.Email,
}, fmt.Sprintf(
`Hello %s. You are receiving this email because you created an account with CloudLink Omega.
You can verify your email address by going to this link: %s
If you are not the intended recipient (or you've changed your mind), please visit this link: %s
If you have questions, comments, or concerns, please reach out to MikeDEV via Discord: https://discord.gg/BZ7TWeMF75
Please support the project by marking this email as "not spam". Beware phishing: We will never ask for your login credentials over email.`,
u.Username,
fmt.Sprintf("%s/api/v0/verify?token=%s", dm.PublicHostname, verifLink),
fmt.Sprintf("%s/api/v0/unsubscribe?token=%s", dm.PublicHostname, verifLink),
)); err != nil {
log.Printf("Error sending welcome email: %s", err)
} else {

// Update user's account state
Expand Down

0 comments on commit b5ee197

Please sign in to comment.