gmail

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Provider is the provider name for Gmail.
	Provider = "gmail"
)

Variables

This section is empty.

Functions

func Factory

func Factory(ctx context.Context, cfg map[string]interface{}) (postoffice.Carrier, error)

Factory creates a Gmail Carrier from cfg.

func Register

func Register(cfg *postoffice.Config)

Register registeres the Gmail factory in cfg.

Types

type Carrier

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

Carrier is the gmail carrier. It is thread-safe.

func NewCarrier

func NewCarrier(ctx context.Context, options ...Option) (*Carrier, error)

NewCarrier creates a new gmail carrier. Credentials must be provided, if GMAIL_CREDENTIALS environment variable is not set. If no scopes are provided, the gmail.MailGoogleComScope (https://mail.google.com/) scope is used.

func (*Carrier) Send

func (c *Carrier) Send(ctx context.Context, let *postoffice.Letter) error

Send sends the letter.

type Option

type Option func(*config)

Option is a gmail carrier option.

func ClientOptions

func ClientOptions(options ...option.ClientOption) Option

ClientOptions adds custom option.ClientOption to the gmail service.

func Credentials

func Credentials(creds *google.Credentials) Option

Credentials adds an option.ClientOption that authenticates API calls.

func CredentialsFile

func CredentialsFile(filename string) Option

CredentialsFile adds an option.ClientOption that authenticates API calls with the given service account or refresh token JSON credentials file.

func CredentialsJSON

func CredentialsJSON(p []byte) Option

CredentialsJSON adds an option.ClientOption that authenticates API calls with the given service account or refresh token JSON credentials.

func Scopes

func Scopes(scopes ...string) Option

Scopes adds gmail scopes.

Jump to

Keyboard shortcuts

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