smtp

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory added in v0.8.0

func Factory(_ context.Context, cfg map[string]interface{}) (postdog.Transport, error)

Factory accepts configuration as a map[string]interface{} and instantiates the SMTP transport from it.

Example configuration:

cfg := map[string]interface{}{
  "host": "smtp.mailtrap.io",
  "port": 587,
  "username": "abcdef123456",
  "password": "654321fedcba",
}

Default host is "localhost". Default port is 587.

func Transport added in v0.8.0

func Transport(host string, port int, username, password string) postdog.Transport

Transport returns an SMTP transport.

func TransportWithSender added in v0.8.0

func TransportWithSender(sender MailSender, host string, port int, username, password string) postdog.Transport

TransportWithSender returns an SMTP transport and accepts a custom implementation of the smtp.SendMail() function.

Types

type MailSender added in v0.8.0

type MailSender interface {
	SendMail(addr string, a sasl.Client, from string, to []string, msg []byte) error
}

MailSender wraps the smtp.SendMail() function in an interface.

Directories

Path Synopsis
Package mock_smtp is a generated GoMock package.
Package mock_smtp is a generated GoMock package.

Jump to

Keyboard shortcuts

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