relay

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package relay provides an interface to relay emails via Amazon SES/Pinpoint API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeniedSender = errors.New(
		"denied sender: sender does not match the allowed emails regexp",
	)

	ErrDeniedRecipients = errors.New(
		"denied recipients: recipients match the denied emails regexp",
	)
)

Functions

func FilterAddresses

func FilterAddresses(
	from string,
	to []string,
	allowFromRegExp *regexp.Regexp,
	denyToRegExp *regexp.Regexp,
) (allowedRecipients []*string, deniedRecipients []*string, err error)

FilterAddresses validates sender and recipients and returns lists for allowed and denied recipients. If the sender is denied, all recipients are denied and an error is returned. If the sender is allowed, but some of the recipients are denied, an error will also be returned.

func Log

func Log(origin net.Addr, from *string, to []*string, err error)

Log creates a log entry and prints it as JSON to STDOUT.

Types

type Client

type Client interface {
	Send(
		origin net.Addr,
		from string,
		to []string,
		data []byte,
	) error
}

Client provides an interface to send emails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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