-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,19 +6,37 @@ import ( | |
"text/template" | ||
) | ||
|
||
const ActivationMailFrom = "[email protected]" | ||
const MailFrom = "[email protected]" | ||
const ActivationMailSubject = "Mantil activation instructions" | ||
const WelcomeMailSubject = "Welcome to Mantil!" | ||
|
||
//go:embed activationMailBody | ||
var activationMailBodyTemplate string | ||
|
||
//go:embed welcomeMailBody | ||
var welcomeMailBodyTemplate string | ||
|
||
func ActivationMailBody(name, activationCode string) (string, error) { | ||
data := struct { | ||
Name string | ||
ActivationCode string | ||
}{name, activationCode} | ||
|
||
tpl, err := template.New("").Parse(activationMailBodyTemplate) | ||
return renderTemplate(data, activationMailBodyTemplate) | ||
} | ||
|
||
const NotActivatedError = `Mantil is not activated. Please fill out the short survey at | ||
www.mantil.com to receive your activation code.` | ||
|
||
func WelcomeMailBody(name string) (string, error) { | ||
data := struct { | ||
Name string | ||
}{name} | ||
return renderTemplate(data, welcomeMailBodyTemplate) | ||
} | ||
|
||
func renderTemplate(data interface{}, content string) (string, error) { | ||
tpl, err := template.New("").Parse(content) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
@@ -28,6 +46,3 @@ func ActivationMailBody(name, activationCode string) (string, error) { | |
} | ||
return buf.String(), nil | ||
} | ||
|
||
const NotActivatedError = `Mantil is not activated. Please fill out the short survey at | ||
www.mantil.com to receive your activation code.` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Hi {{.Name}}, | ||
|
||
Welcome to Mantil! | ||
|
||
The Mantil Team |