Documentation ¶
Index ¶
- type Attachment
- func (at Attachment) Content() []byte
- func (at Attachment) ContentType() string
- func (at Attachment) Filename() string
- func (at Attachment) Header() textproto.MIMEHeader
- func (at Attachment) Map(opts ...MapOption) map[string]interface{}
- func (at *Attachment) Parse(m map[string]interface{})
- func (at Attachment) Size() int
- type AttachmentOption
- type Letter
- func (l Letter) Attachments() []Attachment
- func (l Letter) BCC() []mail.Address
- func (l Letter) CC() []mail.Address
- func (l Letter) Content() (text string, html string)
- func (l Letter) From() mail.Address
- func (l Letter) HTML() string
- func (l Letter) Map(opts ...MapOption) map[string]interface{}
- func (l *Letter) Parse(m map[string]interface{})
- func (l Letter) RFC() string
- func (l Letter) Recipients() []mail.Address
- func (l Letter) ReplyTo() []mail.Address
- func (l Letter) String() string
- func (l Letter) Subject() string
- func (l Letter) Text() string
- func (l Letter) To() []mail.Address
- type MapOption
- type Option
- func Attach(filename string, content []byte, opts ...AttachmentOption) Option
- func AttachFile(filename, path string, opts ...AttachmentOption) Option
- func AttachReader(filename string, r io.Reader, opts ...AttachmentOption) Option
- func BCC(name, addr string) Option
- func BCCAddress(addrs ...mail.Address) Option
- func CC(name, addr string) Option
- func CCAddress(addrs ...mail.Address) Option
- func Content(text, html string) Option
- func From(name, addr string) Option
- func FromAddress(addr mail.Address) Option
- func HTML(s string) Option
- func RFC(body string) Option
- func Recipient(name, addr string) Option
- func RecipientAddress(addrs ...mail.Address) Option
- func ReplyTo(name, addr string) Option
- func ReplyToAddress(addrs ...mail.Address) Option
- func Subject(s string) Option
- func Text(s string) Option
- func To(name, addr string) Option
- func ToAddress(addrs ...mail.Address) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
// contains filtered or unexported fields
}
Attachment is a file attachment.
func (Attachment) Content ¶
func (at Attachment) Content() []byte
Content returns the file contents of the Attachment.
func (Attachment) ContentType ¶
func (at Attachment) ContentType() string
ContentType returns the `Content-Type` of the Attachment.
func (Attachment) Filename ¶
func (at Attachment) Filename() string
Filename returns the filename of the Attachment.
func (Attachment) Header ¶
func (at Attachment) Header() textproto.MIMEHeader
Header returns the MIME headers of the Attachment.
func (Attachment) Map ¶ added in v0.8.0
func (at Attachment) Map(opts ...MapOption) map[string]interface{}
Map maps at to a map[string]interface{}. Use WithoutContent() option to clear the attachment content in the map.
func (*Attachment) Parse ¶ added in v0.8.0
func (at *Attachment) Parse(m map[string]interface{})
Parse parses the map m and applies the values to at.
func (Attachment) Size ¶ added in v0.8.0
func (at Attachment) Size() int
Size returns the filesize of the Attachment.
type AttachmentOption ¶ added in v0.8.0
type AttachmentOption func(*Attachment)
AttachmentOption configures an attachment.
func AttachmentSize ¶ added in v0.8.0
func AttachmentSize(s int) AttachmentOption
AttachmentSize returns an AttachmentOption that explicitly sets / overrides it's size.
func AttachmentType ¶ added in v0.8.0
func AttachmentType(ct string) AttachmentOption
AttachmentType sets the `Content-Type` of the attachment.
type Letter ¶
type Letter struct {
// contains filtered or unexported fields
}
Letter represents a mail.
func Expand ¶ added in v0.8.0
Expand converts the postdog.Mail pm to a Letter.
Add additional information ¶
If pm implements any of the optional methods To(), CC(), BCC(), ReplyTo(), Subject(), Text(), HTML() or Attachments(), those methods will be called to retrieve the information which will be added to the returned Letter.
If pm has an Attachments() method, the return type of that method must be a slice of a type that implements the following methods: Filename() string, Content() []byte, ContentType() string, Header() textproto.MIMEHeader.
func (Letter) Attachments ¶
func (l Letter) Attachments() []Attachment
Attachments returns the attachments of the letter.
func (Letter) Content ¶ added in v0.8.0
Content returns both the text and HTML content of the letter.
func (Letter) Map ¶ added in v0.8.0
Map maps l to a map[string]interface{}. Use WithoutContent() option to clear the attachment contents in the map.
func (Letter) Recipients ¶ added in v0.8.0
Recipients returns all recipients of the letter.
type MapOption ¶ added in v0.8.0
type MapOption func(*mapConfig)
MapOption configures a Map() call.
func WithoutAttachmentContent ¶ added in v0.8.0
func WithoutAttachmentContent() MapOption
WithoutAttachmentContent returns a MapOption that clears the content of one or multiple Attachments.
type Option ¶ added in v0.8.0
Option modifies a letter.
func Attach ¶
func Attach(filename string, content []byte, opts ...AttachmentOption) Option
Attach adds a file attachment to the letter.
func AttachFile ¶
func AttachFile(filename, path string, opts ...AttachmentOption) Option
AttachFile adds the file in path as an attachment to the letter.
func AttachReader ¶ added in v0.8.0
func AttachReader(filename string, r io.Reader, opts ...AttachmentOption) Option
AttachReader adds a file attachment to the letter.
func BCCAddress ¶
BCCAddress adds a `Bcc` recipient to the letter.
func FromAddress ¶
FromAddress sets sender of the letter.
func Recipient ¶ added in v0.8.0
Recipient returns an Option that adds a recipient to a mail. It does NOT add the recipient as to the `To` header of a mail.
func RecipientAddress ¶ added in v0.8.0
RecipientAddress returns an Option that adds a recipient to a mail. It does NOT add the recipient as to the `To` header of a mail.
func ReplyToAddress ¶ added in v0.7.0
ReplyToAddress adds a `Reply-To` recipient to the letter.