Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(go): update email template. #3150

Merged
merged 7 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pro/controllers/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ func inviteUsers(w http.ResponseWriter, r *http.Request) {
// Set E-Mail body. You can set plain text or html with text/html

e := email.UserInvitedMail{
BodyBuilder: &email.EmailBodyBuilderWithH1HeadlineAndImage{},
InviteURL: invite.InviteURL,
BodyBuilder: &email.EmailBodyBuilderWithH1HeadlineAndImage{},
InviteURL: invite.InviteURL,
PlatformRoleID: invite.PlatformRoleID,
}
n := email.Notification{
RecipientMail: invite.Email,
Expand Down
87 changes: 43 additions & 44 deletions pro/email/invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,64 @@ package email

import (
"fmt"
"github.com/gravitl/netmaker/models"
proLogic "github.com/gravitl/netmaker/pro/logic"
"github.com/gravitl/netmaker/servercfg"
)

// UserInvitedMail - mail for users that are invited to a tenant
type UserInvitedMail struct {
BodyBuilder EmailBodyBuilder
InviteURL string
BodyBuilder EmailBodyBuilder
InviteURL string
PlatformRoleID string
}

// GetSubject - gets the subject of the email
func (UserInvitedMail) GetSubject(info Notification) string {
return "You're invited to join Netmaker"
return "Connect to Your Secure Network Using Netmaker"
}

// GetBody - gets the body of the email
func (invite UserInvitedMail) GetBody(info Notification) string {
downloadLink := "https://www.netmaker.io/download"
supportEmail := "[email protected]"

dashboardURL := fmt.Sprintf("https://dashboard.%s", servercfg.GetNmBaseDomain())
if servercfg.DeployedByOperator() {
dashboardURL = fmt.Sprintf("%s/dashboard?tenant_id=%s", proLogic.GetAccountsUIHost(), servercfg.GetNetmakerTenantID())
}

content := invite.BodyBuilder.
WithParagraph("Hi,").
WithParagraph("You've been invited to access a secure network via Netmaker's Remote Access Client (RAC). Follow these simple steps to get connected:").
WithHtml("<ol>").
WithHtml(fmt.Sprintf("<li>Click to <a href=\"%s\">Accept Your Invitation</a> and setup your account.</li>", invite.InviteURL)).
WithHtml("<br>").
WithHtml(fmt.Sprintf("<li><a href=\"%s\">Download the Remote Access Client (RAC)</a>.</li>", downloadLink))

if invite.PlatformRoleID == models.AdminRole.String() || invite.PlatformRoleID == models.PlatformUser.String() {
content = content.
WithHtml("<br>").
WithHtml(fmt.Sprintf("<li>Access the <a href=\"%s\">Netmaker Dashboard</a> - use it to manage your network settings and view network status.</li>", dashboardURL))
}

content = content.
WithHtml("</ol>").
WithParagraph("Important Information:").
WithHtml("<ul>")

if servercfg.DeployedByOperator() {
return invite.BodyBuilder.
WithParagraph("Hi there,").
WithParagraph("<br>").
WithParagraph("Great news! Your colleague has invited you to join their Netmaker SaaS Tenant.").
WithParagraph("Click the button to accept your invitation:").
WithParagraph("<br>").
WithParagraph(fmt.Sprintf("<a class=\"x-button\" href=\"%s\">Accept Invitation</a>", invite.InviteURL)).
WithParagraph("<br>").
WithParagraph("Why you'll love Netmaker:").
WithParagraph("<ul>").
WithParagraph("<li>Blazing-fast connections with our WireGuard®-powered mesh VPN</li>").
WithParagraph("<li>Seamless multi-cloud and hybrid-cloud networking</li>").
WithParagraph("<li>Automated Kubernetes networking across any infrastructure</li>").
WithParagraph("<li>Enterprise-grade security with simple management</li>").
WithParagraph("</ul>").
WithParagraph("Got questions? Our team is here to help you every step of the way.").
WithParagraph("<br>").
WithParagraph("Welcome aboard,").
WithParagraph("<h2>The Netmaker Team</h2>").
WithParagraph("P.S. Curious to learn more before accepting? Check out our quick start tutorial at <a href=\"https://netmaker.io/tutorials\">netmaker.io/tutorials</a>").
Build()
content = content.
WithHtml(fmt.Sprintf("<li>Your Tenant ID: %s</li>", servercfg.GetNetmakerTenantID()))
} else {
content = content.
WithHtml(fmt.Sprintf("<li>Your Netmaker Domain: %s</li>", servercfg.GetFrontendURL()))
}
abhishek9686 marked this conversation as resolved.
Show resolved Hide resolved

return invite.BodyBuilder.
WithParagraph("Hi there,").
WithParagraph("<br>").
WithParagraph("Great news! Your colleague has invited you to join their Netmaker network.").
WithParagraph("Click the button to accept your invitation:").
WithParagraph("<br>").
WithParagraph(fmt.Sprintf("<a class=\"x-button\" href=\"%s\">Accept Invitation</a>", invite.InviteURL)).
WithParagraph("<br>").
WithParagraph("Why you'll love Netmaker:").
WithParagraph("<ul>").
WithParagraph("<li>Blazing-fast connections with our WireGuard®-powered mesh VPN</li>").
WithParagraph("<li>Seamless multi-cloud and hybrid-cloud networking</li>").
WithParagraph("<li>Automated Kubernetes networking across any infrastructure</li>").
WithParagraph("<li>Enterprise-grade security with simple management</li>").
WithParagraph("</ul>").
WithParagraph("Got questions? Our team is here to help you every step of the way.").
WithParagraph("<br>").
WithParagraph("Welcome aboard,").
WithParagraph("<h2>The Netmaker Team</h2>").
WithParagraph("P.S. Curious to learn more before accepting? Check out our quick start tutorial at <a href=\"https://netmaker.io/tutorials\">netmaker.io/tutorials</a>").
return content.
WithHtml("</ul>").
WithParagraph(fmt.Sprintf("If you have any questions or need assistance, please contact our support team at <a href=\"mailto:%s\">%s</a>.", supportEmail, supportEmail)).
WithParagraph("Best regards,").
WithParagraph("The Netmaker Team").
Build()
}
Loading