email

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

admin/email

This package contains logic and templates for sending transactional admin emails.

How templating works

We use MJML to generate the email layout HTML. The MJML templates are found in the templates directory.

To inject content into the email layout HTML, we use Go's built-in html/template library.

We currently have just one template:

  • call_to_action.mjml shows a title, body and button

Adding/updating an MJML template

  1. Add or edit the .mjml file in templates (we recommend using the MJML online IDE)
  2. Run ./admin/email/templates/generate.sh
  3. Add a util function in email.go for loading and populating the template

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallToAction added in v0.28.0

type CallToAction struct {
	ToEmail    string
	ToName     string
	Subject    string
	Title      string
	Body       template.HTML
	ButtonText string
	ButtonLink string
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(sender Sender, frontendURL, externalURL string) *Client

func (*Client) SendCallToAction added in v0.28.0

func (c *Client) SendCallToAction(opts *CallToAction) error

func (*Client) SendOrganizationAddition added in v0.28.0

func (c *Client) SendOrganizationAddition(opts *OrganizationAddition) error

func (*Client) SendOrganizationInvite

func (c *Client) SendOrganizationInvite(opts *OrganizationInvite) error

func (*Client) SendProjectAddition added in v0.28.0

func (c *Client) SendProjectAddition(opts *ProjectAddition) error

func (*Client) SendProjectInvite

func (c *Client) SendProjectInvite(opts *ProjectInvite) error

type OrganizationAddition added in v0.28.0

type OrganizationAddition struct {
	ToEmail       string
	ToName        string
	OrgName       string
	RoleName      string
	InvitedByName string
}

type OrganizationInvite added in v0.28.0

type OrganizationInvite struct {
	ToEmail       string
	ToName        string
	OrgName       string
	RoleName      string
	InvitedByName string
}

type ProjectAddition added in v0.28.0

type ProjectAddition struct {
	ToEmail       string
	ToName        string
	OrgName       string
	ProjectName   string
	RoleName      string
	InvitedByName string
}

type ProjectInvite added in v0.28.0

type ProjectInvite struct {
	ToEmail       string
	ToName        string
	OrgName       string
	ProjectName   string
	RoleName      string
	InvitedByName string
}

type SMTPOptions

type SMTPOptions struct {
	SMTPHost     string
	SMTPPort     int
	SMTPUsername string
	SMTPPassword string
	FromEmail    string
	FromName     string
	BCC          string
}

type Sender

type Sender interface {
	Send(toEmail, toName, subject, body string) error
}

func NewConsoleSender

func NewConsoleSender(logger *zap.Logger, fromEmail, fromName string) (Sender, error)

func NewSMTPSender

func NewSMTPSender(opts *SMTPOptions) (Sender, error)

Jump to

Keyboard shortcuts

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