rfc

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 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.

func BuildConfig added in v0.12.0

func BuildConfig(mail Mail, cfg Config) string

BuildConfig 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 Config added in v0.12.0

type Config struct {
	Clock     Clock
	MessageID MessageIDFactory
}

Config is the builder config.

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 MessageIDFactory added in v0.12.0

type MessageIDFactory interface {
	GenerateID(Mail) string
}

MessageIDFactory generates Message-IDs.

func UUIDGenerator added in v0.11.0

func UUIDGenerator(domain string) MessageIDFactory

UUIDGenerator returns a Message-ID factory using UUIDs. If domain is an empty string, it is set to "localhost". The generated IDs have the following format: <UUID@DOMAIN>

type MessageIDFunc added in v0.12.0

type MessageIDFunc func(Mail) string

MessageIDFunc allows a function to be used as an MessageIDFactory.

func (MessageIDFunc) GenerateID added in v0.12.0

func (id MessageIDFunc) GenerateID(m Mail) string

GenerateID generates a Message-ID.

type Option added in v0.11.0

type Option func(*Config)

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 WithMessageID added in v0.12.0

func WithMessageID(id string) Option

WithMessageID returns an Option that sets the Message-ID of the mail.

func WithMessageIDFactory added in v0.12.1

func WithMessageIDFactory(id MessageIDFactory) Option

WithMessageIDFactory returns an Option that specifies the used MessageIDFactory.

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