email

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MSOButtonStop is the HTML to stop MSO button spacing.
	MSOButtonStop = `<!--[if mso]>
      <i hidden style="mso-font-width: 150%;">&emsp;&#8203;</i>
    <![endif]-->`
	// MSOButtonStart is the HTML to start MSO button spacing.
	MSOButtonStart = `<!--[if mso]>
      <i style="mso-font-width: 150%; mso-text-raise: 30px" hidden>&emsp;</i>
    <![endif]-->`
	// MSOHead is the HTML to start MSO head.
	MSOHead = `` /* 368-byte string literal not displayed */

)

Variables

View Source
var ErrProvider = errors.New("error with email provider")

ErrProvider is returned when there is an error with the email provider.

View Source
var MagicLinkHTMLTemplate string

MagicLinkHTMLTemplate is the HTML template for the magic link email.

View Source
var MagicLinkTextTemplate string

MagicLinkTextTemplate is the text template for the magic link email.

View Source
var OTPHTMLTemplate string

OTPHTMLTemplate is the HTML template for the OTP email.

View Source
var OTPTextTemplate string

OTPTextTemplate is the text template for the OTP email.

Functions

This section is empty.

Types

type Email

type Email struct {
	Subject      string
	TemplateData any
	To           *mail.Address
}

Email is the model for an email.

type MagicLinkTemplateData added in v0.6.0

type MagicLinkTemplateData struct {
	ButtonText   string
	Expiration   string
	Greeting     string
	MagicLink    string
	Meta         TemplateMetadata
	Subtitle     string
	Title        string
	LogoImageURL string
	LogoClickURL string
	LogoAltText  string
	ReCATPTCHA   bool
}

MagicLinkTemplateData is the data for the magic link email template.

type MultiProviderOptions

type MultiProviderOptions struct {
	Logger *slog.Logger
}

MultiProviderOptions are the options for the multi-provider.

type OTPTemplateData added in v0.6.0

type OTPTemplateData struct {
	Expiration   string
	Greeting     string
	MagicLink    string
	Meta         TemplateMetadata
	OTP          string
	Subtitle     string
	Title        string
	LogoImageURL string
	LogoClickURL string
	LogoAltText  string
}

OTPTemplateData is the data for the OTP email template.

type Provider

type Provider interface {
	SendMagicLink(ctx context.Context, e Email) error
	SendOTP(ctx context.Context, e Email) error
}

Provider is the interface for an email provider.

func NewMultiProvider

func NewMultiProvider(providers []Provider, options MultiProviderOptions) (Provider, error)

NewMultiProvider creates a new multiple email provider.

type TemplateMetadata

type TemplateMetadata struct {
	HTMLInstruction string
	HTMLTitle       string
	MSOButtonStop   template.HTML
	MSOButtonStart  template.HTML
	MSOHead         template.HTML
}

TemplateMetadata contains non-configurable metadata for the email templates.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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