Documentation ¶
Index ¶
- Variables
- func AsFilter(f FilterSet) filterSet
- func AsHook(h HookSet) hookSet
- type Address
- type Filter
- type FilterSet
- type Filters
- type Hook
- type HookSet
- type HooksAll
- type HooksSome
- type Logger
- type Option
- type Session
- type Transaction
- func (t Transaction) From() string
- func (t Transaction) HTML() string
- func (t Transaction) Raw() []byte
- func (t Transaction) RcptAddress() string
- func (t Transaction) RcptName() string
- func (t Transaction) SenderAddress() string
- func (t Transaction) SenderName() string
- func (t Transaction) Subject() string
- func (t Transaction) Text() string
- func (t Transaction) To() string
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Address represents an email address.
func MustParseAddr ¶
MustParseAddr creates an Address from one line string.
Panics ¶
- If addr is invalid format for mail address.
func NewAddr ¶
NewAddr creates an Address from user and domain.
Errors ¶
- If provides invalid format for mail address.
func ParseAddr ¶
ParseAddr creates an Address from one line string.
Errors ¶
- If address is invalid format for mail address.
func RandomAddr ¶
RandomAddr creates an Address with user that generated by uuid v4.
Errors ¶
- If provides invalid format for mail address.
type Filter ¶
type Filter interface { // Validate validates a Transaction. // Returns an error if the transaction is invalid. Validate(t Transaction) error }
Filter determains the mail should be recieved.
type FilterSet ¶
type FilterSet interface { // FindFilters returns an array of Filters or an error. // If no Filters matched the key `addr`, returns an empty array. FindFilters(addr Address) ([]Filter, error) }
FilterSet represents a set of filters.
type Filters ¶
type Filters []Filter
Filters is an array of Filter.
func (Filters) Validate ¶
func (f Filters) Validate(t Transaction) error
type Hook ¶
type Hook interface { // Send sends a Transaction. // Returns an error if sending fails. Send(t Transaction) error }
Hook hooks
type HookSet ¶
type HookSet interface { // FindHooks returns an array of Hooks or an error. // If no Hooks matched the key `addr`, returns an empty array. FindHooks(addr Address) ([]Hook, error) }
HookSet represents a set of hooks.
type HooksAll ¶
type HooksAll []Hook
func (HooksAll) Send ¶
func (h HooksAll) Send(t Transaction) error
type HooksSome ¶
type HooksSome []Hook
func (HooksSome) Send ¶
func (h HooksSome) Send(t Transaction) error
type Option ¶
type Option func(*Session)
func WithFilters ¶
WithFilters sets one or more filters into Session. Each filters execute asynchronously. Returns an error immediately if execution of at least one function fails.
func WithHooksAll ¶
WithHooksAll sets one or more hooks into Session. Each hooks execute asynchronously. Returns an error immediately if execution of at least one function fails.
func WithHooksSome ¶
WithHooksSome sets one or more hooks into Session. Each hooks execute asynchronously.
func WithTimeout ¶
type Session ¶
func (Session) Commit ¶
Commit creates, validates, and sends a Transaction.
Errors ¶
- `sender`, `rcpt`, or `envelope` is nil.
- Validate failed.
- Send failed.
func (Session) IntoTransaction ¶
func (s Session) IntoTransaction() (*Transaction, error)
type Transaction ¶
func NewTransaction ¶
func (Transaction) From ¶
func (t Transaction) From() string
func (Transaction) HTML ¶
func (t Transaction) HTML() string
func (Transaction) Raw ¶
func (t Transaction) Raw() []byte
func (Transaction) RcptAddress ¶
func (t Transaction) RcptAddress() string
func (Transaction) RcptName ¶
func (t Transaction) RcptName() string
func (Transaction) SenderAddress ¶
func (t Transaction) SenderAddress() string
func (Transaction) SenderName ¶
func (t Transaction) SenderName() string
func (Transaction) Subject ¶
func (t Transaction) Subject() string
func (Transaction) Text ¶
func (t Transaction) Text() string
func (Transaction) To ¶
func (t Transaction) To() string