Documentation
¶
Index ¶
- Variables
- func NewEmailPipe(conf ...Config) chan<- Email
- type Builder
- func (b *Builder) AddAttachment(file ...string) error
- func (b *Builder) AddHTMLFunc(f func(io.Writer) error, file ...string) error
- func (b *Builder) AddHeader(headers ...string)
- func (b *Builder) AddReplyTo(name, email string)
- func (b *Builder) AddSubjectFunc(f func(io.Writer) error)
- func (b *Builder) AddTextFunc(f func(io.Writer) error)
- func (b *Builder) AddTextHTML(html []byte, file ...string) (err error)
- func (b *Builder) AddTextPlain(text []byte)
- func (b *Builder) Email(id string, resultFunc func(Result)) Email
- func (b *Builder) SetDKIM(domain, selector string, privateKey []byte)
- func (b *Builder) SetFrom(name, email string)
- func (b *Builder) SetSubject(text string)
- func (b *Builder) SetTo(name, email string)
- type Config
- type Connect
- type Email
- type Pipe
- type Result
- type SMTPserver
Constants ¶
This section is empty.
Variables ¶
var ErrPipeStopped = errors.New("email streaming pipe stopped")
Functions ¶
func NewEmailPipe ¶
NewEmailPipe return new chanel for stream send Deprecated: use NewPipe
Types ¶
type Builder ¶
type Builder struct { From string To string Subject string // contains filtered or unexported fields }
Builder helper for create email
func (*Builder) AddAttachment ¶
AddAttachment add attachment files to email
func (*Builder) AddHTMLFunc ¶
AddHTMLFunc add writer function for HTML
func (*Builder) AddReplyTo ¶
AddReplyTo add Reply-To header
func (*Builder) AddSubjectFunc ¶
AddSubjectFunc add writer function for subject
func (*Builder) AddTextFunc ¶
AddTextFunc add writer function for plain text
func (*Builder) AddTextHTML ¶
AddTextHTML add text/html content with related file.
Example use related file in html
AddTextHTML( `... <img src="cid:myImage.jpg" width="500px" height="250px" border="1px" alt="My image"/> ...`, "/path/to/attach/myImage.jpg", )
func (*Builder) AddTextPlain ¶
AddTextPlain add plain text
type Config ¶
type Config struct { Hostname string Iface string Port int Stream int MapIP map[string]string SMTPserver *SMTPserver }
Config profile for sender pool
type Connect ¶
type Connect struct {
// contains filtered or unexported fields
}
Connect to smtp server from configured interface
func (*Connect) SetHostName ¶
SetHostName set server hostname for HELO. If left blanc then use resolv name.
func (*Connect) SetIface ¶
SetIface use this Iface for send. Default use default interface. Example:
IP "1.2.3.4" Socks5 proxy "socks5://user:password@1.2.3.4" or "socks5://1.2.3.4"
func (*Connect) SetSMTPport ¶
SetSMTPport set SMTP server port. Default 25 use for translate local Iface to global if NAT if use Socks server translate Iface SOCKS server to real Iface
type Email ¶
type Email struct { // ID is id for return result ID string // From emailField has format // example // "Name <emailField@domain.tld>" // "<emailField@domain.tld>" // "emailField@domain.tld" From string // To emailField has format as From To string // ResultFunc exec after send emil ResultFunc func(Result) // WriteCloser email body data writer function WriteCloser func(io.WriteCloser) error // contains filtered or unexported fields }
Email struct
func (*Email) Send ¶
func (e *Email) Send(connect *Connect, server *SMTPserver)
Send sending this email
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
Pipe email pipe for send email