Documentation ¶
Overview ¶
Description: This package provides a set of functions to send emails using Fabriktor's email templates. It follows the Google Cloud Pub/Sub message format to send emails asynchronously.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeSpecifics ¶ added in v1.15.5
EncodeSpecifics encodes a map of specifics to a JSON string.
func NewPubSubEmail ¶ added in v1.15.2
func NewPubSubEmail(templateType TemplateName, targetLanguage, recipientEmail, recipientUsername Key, specifics Specifics) (*pubsub.Message, error)
NewPubSubEmail mimicks the reception of a PubSub email message for testing and previewing purposes.
Do not use this function in production code.
Types ¶
type Key ¶ added in v1.15.2
type Key string
const ( PubSubTemplateTypeKey Key = "templateType" PubSubRecipientUsernameKey Key = "recipientUsername" PubSubRecipientEmailKey Key = "recipientEmail" PubSubTargetLanguageKey Key = "targetLanguage" PubSubSpecificsKey Key = "specifics" )
Keys represent the key of the attributes of a Google Pub/Sub message to send an email.
type Specifics ¶ added in v1.15.6
type Specifics map[SpecificsKey]string
func (Specifics) MarshalJSON ¶ added in v1.15.6
Implementation of json.Marshaler interface for Specifics type.
type SpecificsKey ¶ added in v1.15.1
type SpecificsKey string
const ( // For support template. PubSubSpecificsMessageKey SpecificsKey = "msg" // For suspension template. PubSubSpecificsCountKey SpecificsKey = "count" // For suspension template. PubSubSpecificsReasonKey SpecificsKey = "reason" )
Pub/Sub related constants to be used in the `specifics` attribute of a Google Pub/Sub message.
type SuspensionReason ¶
type SuspensionReason string
const ( // MaxInfringementsReached represents the reason for suspension when the maximum number of infringements is reached. MaxInfringementsReached SuspensionReason = "Maximum number of infringements reached" // IdentityUsurpation represents the reason for suspension due to identity usurpation. IdentityUsurpation SuspensionReason = "Identity usurpation" // ProfileDetectedFake represents the reason for suspension when a profile is detected to be fake. ProfileDetectedFake SuspensionReason = "Profile detected to be fake" // ProfileDetectedNotHuman represents the reason for suspension when a profile is detected to be non-human, potentially AI, spam, bot, etc. ProfileDetectedNotHuman SuspensionReason = "Profile detected to be not human, maybe AI, spam, bot, etc." )
Specifics represent predefined values for the `reason` subfield of `specifics` attribute of a Google Pub/Sub message.
type TemplateName ¶
type TemplateName string
New type definitions.
const ( WelcomeTemplate TemplateName = "welcome" SupportTemplate TemplateName = "support" DeletionTemplate TemplateName = "deletion" ForbiddenTemplate TemplateName = "forbidden" WarningTemplate TemplateName = "warning" SuspensionTemplate TemplateName = "suspension" )
TemplateName represent the name of Fabriktor's email templates. To be assigned to the `templateType` attribute of a Google Pub/Sub message.