rfc

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(mail Mail, opts ...Option) string

Build the mail according to RFC 5322.

Types

type Attachment

type Attachment struct {
	Filename string
	Content  []byte
	Header   textproto.MIMEHeader
}

Attachment is a mail attachment.

type Clock added in v0.11.0

type Clock interface {
	Now() time.Time
}

A Clock provides the current time.

type ClockFunc added in v0.11.0

type ClockFunc func() time.Time

ClockFunc allows a function to be used as a Clock.

func (ClockFunc) Now added in v0.11.0

func (c ClockFunc) Now() time.Time

Now returns the current time.

type IDGenerator added in v0.11.0

type IDGenerator interface {
	GenerateID(Mail) string
}

IDGenerator generates Message-IDs.

func UUIDGenerator added in v0.11.0

func UUIDGenerator(domain string) IDGenerator

UUIDGenerator returns a Message-ID generator using UUIDs. If domain is an empty string, GenerateID() just returns a UUID. Otherwise the generated IDs have the following format: <UUID@DOMAIN>

type IDGeneratorFunc added in v0.11.0

type IDGeneratorFunc func(Mail) string

IDGeneratorFunc allows a function to be used as an IDGenerator.

func (IDGeneratorFunc) GenerateID added in v0.11.0

func (gen IDGeneratorFunc) GenerateID(m Mail) string

GenerateID generates a Message-ID.

type Mail

type Mail struct {
	Subject     string
	From        mail.Address
	To          []mail.Address
	CC          []mail.Address
	BCC         []mail.Address
	ReplyTo     []mail.Address
	Text        string
	HTML        string
	Attachments []Attachment
}

Mail contains the data of a mail.

type Option added in v0.11.0

type Option func(*builder)

Option is a builder option.

func WithClock added in v0.11.0

func WithClock(c Clock) Option

WithClock returns an Option that overrides the used Clock.

func WithIDGenerator added in v0.11.0

func WithIDGenerator(gen IDGenerator) Option

WithIDGenerator returns an Option that overrides the used IDGenerator.

Directories

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

Jump to

Keyboard shortcuts

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