Documentation
¶
Overview ¶
Package email implements utility for rendering the Email.
The email package supports transifex translation for email templates.
Index ¶
- Variables
- func RenderEmailTemplate(mt MessageTemplate, locale, defaultLocale string, emailTemplatePath string, ...) (*channels.Message, error)
- func RenderGroupedEmailTemplate(gmt GroupedMessageTemplate, vars map[string]string, ...) (*channels.Message, error)
- type GroupedMessageTemplate
- type MessageTemplate
Constants ¶
This section is empty.
Variables ¶
var ( ShareCreated = MessageTemplate{ Subject: l10n.Template(`{ShareSharer} shared '{ShareFolder}' with you`), Greeting: l10n.Template(`Hello {ShareGrantee}`), MessageBody: l10n.Template(`{ShareSharer} has shared "{ShareFolder}" with you.`), CallToAction: l10n.Template(`Click here to view it: {ShareLink}`), // contains filtered or unexported fields } Subject: l10n.Template(`Share to '{ShareFolder}' expired at {ExpiredAt}`), Greeting: l10n.Template(`Hello {ShareGrantee},`), MessageBody: l10n.Template(`Your share to {ShareFolder} has expired at {ExpiredAt} Even though this share has been revoked you still might have access through other shares and/or space memberships.`), // contains filtered or unexported fields } SharedSpace = MessageTemplate{ Subject: l10n.Template("{SpaceSharer} invited you to join {SpaceName}"), Greeting: l10n.Template(`Hello {SpaceGrantee},`), MessageBody: l10n.Template(`{SpaceSharer} has invited you to join "{SpaceName}".`), CallToAction: l10n.Template(`Click here to view it: {ShareLink}`), // contains filtered or unexported fields } Subject: l10n.Template(`{SpaceSharer} removed you from {SpaceName}`), Greeting: l10n.Template(`Hello {SpaceGrantee},`), MessageBody: l10n.Template(`{SpaceSharer} has removed you from "{SpaceName}". You might still have access through your other groups or direct membership.`), CallToAction: l10n.Template(`Click here to check it: {ShareLink}`), // contains filtered or unexported fields } MembershipExpired = MessageTemplate{ Subject: l10n.Template(`Membership of '{SpaceName}' expired at {ExpiredAt}`), Greeting: l10n.Template(`Hello {SpaceGrantee},`), MessageBody: l10n.Template(`Your membership of space {SpaceName} has expired at {ExpiredAt} Even though this membership has expired you still might have access through other shares and/or space memberships`), // contains filtered or unexported fields } ScienceMeshInviteTokenGenerated = MessageTemplate{ Subject: l10n.Template(`ScienceMesh: {InitiatorName} wants to collaborate with you`), Greeting: l10n.Template(`Hi,`), MessageBody: l10n.Template(`{ShareSharer} ({ShareSharerMail}) wants to start sharing collaboration resources with you. To accept the invite, please visit the following URL: {ShareLink} Alternatively, you can visit your federation settings and use the following details: Token: {Token} ProviderDomain: {ProviderDomain}`), // contains filtered or unexported fields } Subject: l10n.Template(`ScienceMesh: {InitiatorName} wants to collaborate with you`), Greeting: l10n.Template(`Hi,`), MessageBody: l10n.Template(`{ShareSharer} ({ShareSharerMail}) wants to start sharing collaboration resources with you. Please visit your federation settings and use the following details: Token: {Token} ProviderDomain: {ProviderDomain}`), // contains filtered or unexported fields } Grouped = GroupedMessageTemplate{ Subject: l10n.Template(`Report`), Greeting: l10n.Template(`Hi {DisplayName},`), MessageBody: "", // contains filtered or unexported fields } )
the available templates
Functions ¶
func RenderEmailTemplate ¶
func RenderEmailTemplate(mt MessageTemplate, locale, defaultLocale string, emailTemplatePath string, translationPath string, vars map[string]string) (*channels.Message, error)
RenderEmailTemplate is responsible to prepare a message which than can be used to notify the user via email.
func RenderGroupedEmailTemplate ¶
func RenderGroupedEmailTemplate(gmt GroupedMessageTemplate, vars map[string]string, locale, defaultLocale string, emailTemplatePath string, translationPath string, mts []MessageTemplate, mtsVars []map[string]string) (*channels.Message, error)
RenderGroupedEmailTemplate is responsible to prepare a message which than can be used to notify the user via email.
Types ¶
type GroupedMessageTemplate ¶
type GroupedMessageTemplate struct {
// The fields below represent the placeholders for the translatable templates
Subject string
Greeting string
MessageBody string
// contains filtered or unexported fields
}
GroupedMessageTemplate is the data structure for the email
func NewGroupedHTMLTemplate ¶
func NewGroupedHTMLTemplate(gmt GroupedMessageTemplate, vars map[string]string, locale, defaultLocale string, translationPath string, mts []MessageTemplate, mtsVars []map[string]string) (GroupedMessageTemplate, error)
NewGroupedHTMLTemplate replace the body message template placeholders with the translated template
func NewGroupedTextTemplate ¶
func NewGroupedTextTemplate(gmt GroupedMessageTemplate, vars map[string]string, locale, defaultLocale string, translationPath string, mts []MessageTemplate, mtsVars []map[string]string) (GroupedMessageTemplate, error)
NewGroupedTextTemplate replace the body message template placeholders with the translated template
type MessageTemplate ¶
type MessageTemplate struct {
// The fields below represent the placeholders for the translatable templates
Subject string
Greeting string
MessageBody string
CallToAction string
// contains filtered or unexported fields
}
MessageTemplate is the data structure for the email
func NewHTMLTemplate ¶
func NewHTMLTemplate(mt MessageTemplate, locale, defaultLocale string, translationPath string, vars map[string]string) (MessageTemplate, error)
NewHTMLTemplate replace the body message template placeholders with the translated template
func NewTextTemplate ¶
func NewTextTemplate(mt MessageTemplate, locale, defaultLocale string, translationPath string, vars map[string]string) (MessageTemplate, error)
NewTextTemplate replace the body message template placeholders with the translated template