Documentation ¶
Index ¶
- type A
- 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 ...mapper.Option) map[string]interface{}
- func (at *Attachment) Parse(m map[string]interface{})
- func (at Attachment) Size() int
- type AttachmentOption
- type L
- 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 ...mapper.Option) map[string]interface{}
- func (l *Letter) Parse(m map[string]interface{})
- func (l Letter) RFC() string
- func (l Letter) RFCConfig() rfc.Config
- 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
- func (l Letter) WithAttachments(attach ...Attachment) Letter
- func (l Letter) WithBCC(addrs ...mail.Address) Letter
- func (l Letter) WithCC(addrs ...mail.Address) Letter
- func (l Letter) WithContent(text, html string) Letter
- func (l Letter) WithFrom(name, addr string) Letter
- func (l Letter) WithFromAddress(addr mail.Address) Letter
- func (l Letter) WithHTML(h string) Letter
- func (l Letter) WithRFC(rfc string) Letter
- func (l Letter) WithRFCConfig(cfg rfc.Config) Letter
- func (l Letter) WithRFCOptions(opts ...rfc.Option) Letter
- func (l Letter) WithRecipients(addrs ...mail.Address) Letter
- func (l Letter) WithReplyTo(addrs ...mail.Address) Letter
- func (l Letter) WithSubject(s string) Letter
- func (l Letter) WithText(t string) Letter
- func (l Letter) WithTo(addrs ...mail.Address) Letter
- 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 A ¶ added in v0.15.1
type A struct { Filename string Content []byte ContentType string Size int // overrides the actual size if != 0 Header textproto.MIMEHeader }
A contains the fields of Attachment.
type Attachment ¶
type Attachment struct {
A
}
Attachment is a file attachment.
func NewAttachment ¶ added in v0.12.0
func NewAttachment(filename string, content []byte, opts ...AttachmentOption) Attachment
NewAttachment creates an Attachment from the given filename, content and opts.
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 ...mapper.Option) 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 L ¶ added in v0.15.0
type L struct { Subject string From mail.Address Recipients []mail.Address To []mail.Address CC []mail.Address BCC []mail.Address ReplyTo []mail.Address RFC string Text string HTML string Attachments []Attachment }
L contains the fields of a Letter.
type Letter ¶
type Letter struct { L // 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.
If pm implements an RFCConfig() method, it will be used to add an rfc.Config to the Letter.
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) RFCConfig ¶ added in v0.12.0
RFCConfig returns the RFC config that is used when calling l.L.RFC().
func (Letter) Recipients ¶ added in v0.8.0
Recipients returns all recipients of the letter.
func (Letter) WithAttachments ¶ added in v0.12.0
func (l Letter) WithAttachments(attach ...Attachment) Letter
WithAttachments returns a copy of l with attach as it's attachments.
func (Letter) WithBCC ¶ added in v0.12.0
WithBCC returns a copy of l with addrs as it's `BCC` recipients.
func (Letter) WithCC ¶ added in v0.12.0
WithCC returns a copy of l with addrs as it's `CC` recipients.
func (Letter) WithContent ¶ added in v0.12.0
WithContent returns a copy of l with text as it's text content and html as it's HTML content.
func (Letter) WithFrom ¶ added in v0.12.0
WithFrom returns a copy of l with an updated `From` field.
func (Letter) WithFromAddress ¶ added in v0.12.0
WithFromAddress returns a copy of l with addr as it's `From` field.
func (Letter) WithRFC ¶ added in v0.12.5
WithRFC returns a copy of l with it's rfc body replaced by rfc.
func (Letter) WithRFCConfig ¶ added in v0.12.2
WithRFCConfig returns a copy of l with it's rfc configuration replaced by cfg.
func (Letter) WithRFCOptions ¶ added in v0.12.0
WithRFCOptions returns a copy of l with it's rfc configuration replaced.
func (Letter) WithRecipients ¶ added in v0.12.0
WithRecipients returns a copy of l with addrs as it's recipients.
func (Letter) WithReplyTo ¶ added in v0.12.0
WithReplyTo returns a copy of l with addrs as it's `ReplyTo` field.
func (Letter) WithSubject ¶ added in v0.12.0
WithSubject returns a copy of l withs it's subject set to s.
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.