emails

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	APIKey       string `split_words:"true" required:"false"`
	FromEmail    string `split_words:"true" default:"ensign@rotational.io"`
	AdminEmail   string `split_words:"true" default:"admins@rotational.io"`
	EnsignListID string `split_words:"true" required:"false"`
}

Configures SendGrid for sending emails and managing marketing contacts.

func (Config) Enabled

func (c Config) Enabled() bool

Returns true if there is a SendGrid API key available

func (Config) Validate

func (c Config) Validate() (err error)

From and admin emails are required if the SendGrid API is enabled.

type EmailManager

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

EmailManager allows a server to send rich emails using the SendGrid service.

func New

func New(conf Config) (m *EmailManager, err error)

New email manager with the specified configuration.

func (*EmailManager) Send

func (m *EmailManager) Send(message *sgmail.SGMailV3) (err error)

type SendGridClient

type SendGridClient interface {
	Send(email *sgmail.SGMailV3) (*rest.Response, error)
}

SendGridClient is an interface that can be implemented by live email clients to send real emails or by mock clients for testing.

Jump to

Keyboard shortcuts

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