mailer

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Overview

Package mailer sends emails via gmail asynchronously.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	To      []string
	Subject string
	Body    string
}

Email represents a single email.

type Mailer

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

Mailer sends emails asynchronously via gmail.

func New

func New(emailId, password string) *Mailer

New creates a new instance. emailId and password are the gmail sender address and password respectively.

func (*Mailer) Send

func (m *Mailer) Send(email Email)

Send sends one email asynchronously returning immediately. When it eventually sends the email, it reports any errors to stderr.

func (*Mailer) SendFuture added in v0.13.0

func (m *Mailer) SendFuture(email Email) <-chan error

SendFuture sends one email asynchronously returning immediately. Caller must use returned channel to get the result of the send.

func (*Mailer) Shutdown added in v0.13.0

func (m *Mailer) Shutdown()

Shutdown shuts down this mailer. Shutdown waits to return until all pending emails have been sent. It is an error to call Send or SendFuture after calling Shutdown.

Jump to

Keyboard shortcuts

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