Documentation
¶
Overview ¶
Package mail defines immutable outbound messages and a replaceable delivery boundary. Transport implementations live in subpackages.
Index ¶
- Constants
- Variables
- type Message
- func (message Message) Date() time.Time
- func (message Message) From() netmail.Address
- func (message Message) HTML() string
- func (message Message) ReplyTo() (netmail.Address, bool)
- func (message Message) Subject() string
- func (message Message) Text() string
- func (message Message) To() []netmail.Address
- func (message Message) WriteRFC5322(writer io.Writer) error
- type MessageError
- type MessageOptions
- type Sender
Constants ¶
View Source
const ( // MaximumRecipients bounds one SMTP transaction and its To header. MaximumRecipients = 100 // MaximumHeaderBytes is the RFC 5322 hard limit for one header line, // excluding its terminating CRLF. MaximumHeaderBytes = 998 // MaximumBodyBytes bounds the combined unencoded text and HTML bodies. MaximumBodyBytes = 4 << 20 )
Variables ¶
View Source
var ErrInvalidMessage = errors.New("mail: invalid message")
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is an immutable, validated email message.
func NewMessage ¶
func NewMessage(options MessageOptions) (Message, error)
NewMessage validates and snapshots an outbound message. At least one of Text or HTML is required; supplying both emits multipart/alternative.
type MessageError ¶
type MessageError struct {
// contains filtered or unexported fields
}
MessageError identifies a bad field without including submitted content.
func (*MessageError) Error ¶
func (err *MessageError) Error() string
func (*MessageError) Field ¶
func (err *MessageError) Field() string
func (*MessageError) Unwrap ¶
func (err *MessageError) Unwrap() error
type MessageOptions ¶
type MessageOptions struct {
From netmail.Address
To []netmail.Address
ReplyTo *netmail.Address
Subject string
Text string
HTML string
// Date defaults to the construction time. Supplying it is useful for
// deterministic fixtures and messages restored from an outbox.
Date time.Time
}
MessageOptions is consumed by NewMessage. NewMessage copies all values, so later changes to this structure or its To slice cannot alter the Message.
Click to show internal directories.
Click to hide internal directories.