Documentation ¶
Index ¶
- Constants
- Variables
- func NewEmailPipe(conf ...Config) chan<- Email
- type Builder
- func (b *Builder) AddAMPFunc(f func(io.Writer) error) *Builder
- func (b *Builder) AddAMPPart(amp []byte) *Builder
- func (b *Builder) AddAttachment(file ...string) error
- func (b *Builder) AddHTMLFunc(f func(io.Writer) error, file ...string) error
- func (b *Builder) AddHTMLPart(html []byte, file ...string) (err error)
- func (b *Builder) AddHeader(headers ...string) *Builder
- func (b *Builder) AddMIMEHeader(mimeHeader textproto.MIMEHeader) *Builder
- func (b *Builder) AddReplyTo(name, email string) *Builder
- func (b *Builder) AddSubjectFunc(f func(io.Writer) error) *Builder
- func (b *Builder) AddTextFunc(f func(io.Writer) error) *Builder
- func (b *Builder) AddTextHTML(html []byte, file ...string) (err error)
- func (b *Builder) AddTextPart(text []byte) *Builder
- 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) *Builder
- func (b *Builder) SetDKIMSignMethod(signMethod int) *Builder
- func (b *Builder) SetFrom(name, email string) *Builder
- func (b *Builder) SetSubject(subject string) *Builder
- func (b *Builder) SetTo(name, email string) *Builder
- type Config
- type Connect
- type DelimitWriter
- type Email
- type Pipe
- type Result
- type SMTPserver
Constants ¶
const ( DKIMSignMethodDoubleWrite = iota DKIMSignMethodBufferWrite )
const Version = "0.0.8"
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) AddAMPFunc ¶ added in v0.0.6
AddAMPFunc add writer function for AMP HTML
func (*Builder) AddAMPPart ¶ added in v0.0.6
AddAMPPart add text/x-amp-html content with related file.
func (*Builder) AddAttachment ¶
AddAttachment add attachment files to email
func (*Builder) AddHTMLFunc ¶
AddHTMLFunc add writer function for HTML
func (*Builder) AddHTMLPart ¶ added in v0.0.6
AddHTMLPart add text/html content with related file.
Example use related file in html
AddHTMLPart( `... <img src="cid:myImage.jpg" width="500px" height="250px" border="1px" alt="My image"/> ...`, "/path/to/attach/myImage.jpg", )
func (*Builder) AddMIMEHeader ¶ added in v0.0.6
func (b *Builder) AddMIMEHeader(mimeHeader textproto.MIMEHeader) *Builder
AddMIMEHeader add extra mime header to email
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 Deprecated: use AddHTMLPart
func (*Builder) AddTextPart ¶ added in v0.0.6
AddTextPart add plain text
func (*Builder) AddTextPlain ¶
AddTextPlain add plain text Deprecated: use AddTextPart
func (*Builder) SetDKIMSignMethod ¶ added in v0.0.12
func (*Builder) SetSubject ¶
SetSubject set email subject
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 DelimitWriter ¶ added in v0.0.6
type DelimitWriter struct {
// contains filtered or unexported fields
}
DelimitWriter Writer with delimiter bytes
func NewDelimitWriter ¶ added in v0.0.6
func NewDelimitWriter(writer io.Writer, delimiter []byte, cnt int) *DelimitWriter
NewDelimitWriter get writer, delimit bytes and count through which to add a delimit bytes. Return DelimitWriter
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 // DontUseTLS STARTTLS off DontUseTLS bool // 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
Directories ¶
Path | Synopsis |
---|---|
Example use: sendemail -V -f from@domain.tld -t to@domain.tld -s "Hello subject!" -m "Hello, world!" sendemail -f from@domain.tld -t to@domain.tld -s "Hello subject!" -html ./message.html -amp ./amp.html -txt ./message.txt
|
Example use: sendemail -V -f from@domain.tld -t to@domain.tld -s "Hello subject!" -m "Hello, world!" sendemail -f from@domain.tld -t to@domain.tld -s "Hello subject!" -html ./message.html -amp ./amp.html -txt ./message.txt |