Documentation ¶
Index ¶
- Variables
- func LoadTemplateString(mightBeFilePath string) string
- func MakePongoContext(srcCtx map[string]any) pongo.Context
- func MakeTemplateContext(srcCtx map[string]any) map[string]any
- type AddressType
- type Courier
- type Envelope
- func (em *Envelope) AddBccAddress(address string)
- func (em *Envelope) AddBccAddresses(addresses []string)
- func (em *Envelope) AddCcAddress(address string)
- func (em *Envelope) AddCcAddresses(addresses []string)
- func (em *Envelope) AddToAddress(address string)
- func (em *Envelope) AddToAddresses(addresses []string)
- func (em *Envelope) GetBccAddresses() []mail.Address
- func (em *Envelope) GetCcAddresses() []mail.Address
- func (em *Envelope) GetErrors() error
- func (em *Envelope) GetToAddresses() []mail.Address
- func (em *Envelope) HasErrors() bool
- func (em *Envelope) SetFromAddress(address string)
- func (em *Envelope) SetReplyToAddress(address string)
- func (em *Envelope) Stamp(msg *smail.Email)
- type Message
- func (c *Message) AddAttachment(filePath string, fileName string)
- func (c *Message) AddFile(file *smail.File)
- func (c *Message) Message() *smail.Email
- func (c *Message) Seal(envelope *Envelope)
- func (c *Message) SetHtmlBody(html string)
- func (c *Message) SetPriority(isHigh bool)
- func (c *Message) SetPriorityHigh()
- func (c *Message) SetPriorityLow()
- func (c *Message) SetSubject(subject string)
- func (c *Message) SetTextBody(text string)
- func (c *Message) String() string
- type PongoScribe
- func (ps *PongoScribe) Close()
- func (ps *PongoScribe) Compose(ctx ...any) Scribe
- func (ps *PongoScribe) GetErrors() error
- func (ps *PongoScribe) HasErrors() bool
- func (ps *PongoScribe) Include(filepath string, name ...string)
- func (ps *PongoScribe) Message() *smail.Email
- func (ps *PongoScribe) Open() (*Message, error)
- func (ps *PongoScribe) Seal(envelope *Envelope) Scribe
- func (ps *PongoScribe) SetBodyTemplate(text string, html bool)
- func (ps *PongoScribe) SetHtmlBodyTemplate(html string)
- func (ps *PongoScribe) SetPriority(isHigh bool)
- func (ps *PongoScribe) SetSubjectTemplate(subject string)
- func (ps *PongoScribe) SetTextBodyTemplate(text string)
- type Scribe
- type SimpleTextScribe
- func (sts *SimpleTextScribe) Close()
- func (sts *SimpleTextScribe) Compose(ctx ...any) Scribe
- func (sts *SimpleTextScribe) GetErrors() error
- func (sts *SimpleTextScribe) HasErrors() bool
- func (sts *SimpleTextScribe) Include(filepath string, name ...string)
- func (sts *SimpleTextScribe) Message() *smail.Email
- func (sts *SimpleTextScribe) Open() (*Message, error)
- func (sts *SimpleTextScribe) Seal(envelope *Envelope) Scribe
- func (sts *SimpleTextScribe) SetBodyTemplate(text string, html bool)
- func (sts *SimpleTextScribe) SetHtmlBodyTemplate(html string)
- func (sts *SimpleTextScribe) SetPriority(isHigh bool)
- func (sts *SimpleTextScribe) SetSubjectTemplate(subject string)
- func (sts *SimpleTextScribe) SetTextBodyTemplate(text string)
- type TemplateScribe
- func (ps *TemplateScribe) Close()
- func (ps *TemplateScribe) Compose(ctx ...any) Scribe
- func (ps *TemplateScribe) GetErrors() error
- func (ps *TemplateScribe) HasErrors() bool
- func (ps *TemplateScribe) Include(filepath string, name ...string)
- func (ps *TemplateScribe) Message() *smail.Email
- func (ps *TemplateScribe) Open() (*Message, error)
- func (ps *TemplateScribe) Seal(envelope *Envelope) Scribe
- func (ps *TemplateScribe) SetBodyTemplate(text string, html bool)
- func (ps *TemplateScribe) SetHtmlBodyTemplate(html string)
- func (ps *TemplateScribe) SetPriority(isHigh bool)
- func (ps *TemplateScribe) SetSubjectTemplate(subject string)
- func (ps *TemplateScribe) SetTextBodyTemplate(text string)
Constants ¶
This section is empty.
Variables ¶
var EmptyAddress = mail.Address{}
Functions ¶
func LoadTemplateString ¶
LoadTemplateString does some basic checks to determine if the input string might be a file path, and if so attempts to open the file for reading. If it is a readable file path, then it returns the contents of the file, otherwise returns the original string value.
Types ¶
type AddressType ¶
type AddressType int
const ( FromAddress AddressType = iota ReplyToAddress ToAddress CcAddress BccAddress )
type Courier ¶
type Courier struct {
// contains filtered or unexported fields
}
Courier defines an smtp server/client responsible for "delivering" messages.
type Envelope ¶
type Envelope struct { FromAddress mail.Address ReplyToAddress mail.Address // contains filtered or unexported fields }
func NewEnvelope ¶
func NewEnvelope() *Envelope
func (*Envelope) AddBccAddress ¶
func (*Envelope) AddBccAddresses ¶
func (*Envelope) AddCcAddress ¶
func (*Envelope) AddCcAddresses ¶
func (*Envelope) AddToAddress ¶
func (*Envelope) AddToAddresses ¶
func (*Envelope) GetBccAddresses ¶
func (*Envelope) GetCcAddresses ¶
func (*Envelope) GetToAddresses ¶
func (*Envelope) SetFromAddress ¶
func (*Envelope) SetReplyToAddress ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message wraps an email struct
func NewMessage ¶
func NewMessage() *Message
func (*Message) AddAttachment ¶
func (*Message) SetHtmlBody ¶
SetHtmlBody sets the html email body, and flags the text body to be set as the alternative. Setting the html body with an empty string has no effect, other than to flag the text body as the primary.
func (*Message) SetPriority ¶
func (*Message) SetPriorityHigh ¶
func (c *Message) SetPriorityHigh()
func (*Message) SetPriorityLow ¶
func (c *Message) SetPriorityLow()
func (*Message) SetSubject ¶
SetSubject sets the email subject to the provided string value.
func (*Message) SetTextBody ¶
SetTextBody sets the raw text email body. If the text body has been set after the Html body, it is set as the alternative body of the email, otherwise it will be treated as the primary. Setting the text body with an empty string has no effect.
type PongoScribe ¶
type PongoScribe struct {
// contains filtered or unexported fields
}
PongoScribe
func NewPongoScribe ¶
func NewPongoScribe() *PongoScribe
func (*PongoScribe) Close ¶
func (ps *PongoScribe) Close()
func (*PongoScribe) Compose ¶
func (ps *PongoScribe) Compose(ctx ...any) Scribe
func (*PongoScribe) GetErrors ¶
func (ps *PongoScribe) GetErrors() error
func (*PongoScribe) HasErrors ¶
func (ps *PongoScribe) HasErrors() bool
func (*PongoScribe) Include ¶
func (ps *PongoScribe) Include(filepath string, name ...string)
func (*PongoScribe) Message ¶
func (ps *PongoScribe) Message() *smail.Email
func (*PongoScribe) Open ¶
func (ps *PongoScribe) Open() (*Message, error)
func (*PongoScribe) Seal ¶
func (ps *PongoScribe) Seal(envelope *Envelope) Scribe
func (*PongoScribe) SetBodyTemplate ¶
func (ps *PongoScribe) SetBodyTemplate(text string, html bool)
func (*PongoScribe) SetHtmlBodyTemplate ¶
func (ps *PongoScribe) SetHtmlBodyTemplate(html string)
func (*PongoScribe) SetPriority ¶
func (ps *PongoScribe) SetPriority(isHigh bool)
func (*PongoScribe) SetSubjectTemplate ¶
func (ps *PongoScribe) SetSubjectTemplate(subject string)
func (*PongoScribe) SetTextBodyTemplate ¶
func (ps *PongoScribe) SetTextBodyTemplate(text string)
type Scribe ¶
type Scribe interface { SetPriority(bool) SetSubjectTemplate(string) SetTextBodyTemplate(string) SetHtmlBodyTemplate(string) SetBodyTemplate(string, bool) Include(string, ...string) Open() (*Message, error) Close() Seal(*Envelope) Scribe Compose(...any) Scribe Message() *smail.Email HasErrors() bool GetErrors() error }
Scribe creates messages.
type SimpleTextScribe ¶
type SimpleTextScribe struct {
// contains filtered or unexported fields
}
SimpleTextScribe renders plain static text for the email body.
func NewSimpleTextScribe ¶
func NewSimpleTextScribe() *SimpleTextScribe
func (*SimpleTextScribe) Close ¶
func (sts *SimpleTextScribe) Close()
func (*SimpleTextScribe) Compose ¶
func (sts *SimpleTextScribe) Compose(ctx ...any) Scribe
func (*SimpleTextScribe) GetErrors ¶
func (sts *SimpleTextScribe) GetErrors() error
func (*SimpleTextScribe) HasErrors ¶
func (sts *SimpleTextScribe) HasErrors() bool
func (*SimpleTextScribe) Include ¶
func (sts *SimpleTextScribe) Include(filepath string, name ...string)
func (*SimpleTextScribe) Message ¶
func (sts *SimpleTextScribe) Message() *smail.Email
func (*SimpleTextScribe) Open ¶
func (sts *SimpleTextScribe) Open() (*Message, error)
func (*SimpleTextScribe) Seal ¶
func (sts *SimpleTextScribe) Seal(envelope *Envelope) Scribe
func (*SimpleTextScribe) SetBodyTemplate ¶
func (sts *SimpleTextScribe) SetBodyTemplate(text string, html bool)
func (*SimpleTextScribe) SetHtmlBodyTemplate ¶
func (sts *SimpleTextScribe) SetHtmlBodyTemplate(html string)
func (*SimpleTextScribe) SetPriority ¶
func (sts *SimpleTextScribe) SetPriority(isHigh bool)
func (*SimpleTextScribe) SetSubjectTemplate ¶
func (sts *SimpleTextScribe) SetSubjectTemplate(subject string)
func (*SimpleTextScribe) SetTextBodyTemplate ¶
func (sts *SimpleTextScribe) SetTextBodyTemplate(text string)
type TemplateScribe ¶ added in v0.2.0
type TemplateScribe struct {
// contains filtered or unexported fields
}
TemplateScribe
func NewTemplateScribe ¶ added in v0.2.0
func NewTemplateScribe() *TemplateScribe
func (*TemplateScribe) Close ¶ added in v0.2.0
func (ps *TemplateScribe) Close()
func (*TemplateScribe) Compose ¶ added in v0.2.0
func (ps *TemplateScribe) Compose(ctx ...any) Scribe
func (*TemplateScribe) GetErrors ¶ added in v0.2.0
func (ps *TemplateScribe) GetErrors() error
func (*TemplateScribe) HasErrors ¶ added in v0.2.0
func (ps *TemplateScribe) HasErrors() bool
func (*TemplateScribe) Include ¶ added in v0.2.0
func (ps *TemplateScribe) Include(filepath string, name ...string)
func (*TemplateScribe) Message ¶ added in v0.2.0
func (ps *TemplateScribe) Message() *smail.Email
func (*TemplateScribe) Open ¶ added in v0.2.0
func (ps *TemplateScribe) Open() (*Message, error)
func (*TemplateScribe) Seal ¶ added in v0.2.0
func (ps *TemplateScribe) Seal(envelope *Envelope) Scribe
func (*TemplateScribe) SetBodyTemplate ¶ added in v0.2.0
func (ps *TemplateScribe) SetBodyTemplate(text string, html bool)
func (*TemplateScribe) SetHtmlBodyTemplate ¶ added in v0.2.0
func (ps *TemplateScribe) SetHtmlBodyTemplate(html string)
func (*TemplateScribe) SetPriority ¶ added in v0.2.0
func (ps *TemplateScribe) SetPriority(isHigh bool)
func (*TemplateScribe) SetSubjectTemplate ¶ added in v0.2.0
func (ps *TemplateScribe) SetSubjectTemplate(subject string)
func (*TemplateScribe) SetTextBodyTemplate ¶ added in v0.2.0
func (ps *TemplateScribe) SetTextBodyTemplate(text string)