email

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package email implements utility for rendering the Email.

The email package supports transifex translation for email templates.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Shares
	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
	}

	ShareExpired = MessageTemplate{

		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
	}

	// Spaces templates
	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
	}

	UnsharedSpace = MessageTemplate{

		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
	}

	ScienceMeshInviteTokenGeneratedWithoutShareLink = 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.
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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL