Documentation
¶
Index ¶
- func ParseAddress(s string) (*mail.Address, error)
- type Attachment
- type DirectSender
- type Email
- func (m *Email) AddAttachment(as ...*Attachment)
- func (m *Email) AddBcc(bccs ...string) error
- func (m *Email) AddCc(ccs ...string) error
- func (m *Email) AddReply(rs ...string) error
- func (m *Email) AddTo(tos ...string) error
- func (m *Email) AttachFile(paths ...string) error
- func (m *Email) AttachString(name string, data string)
- func (m *Email) EmbedFile(cid string, path string) error
- func (m *Email) EmbedString(cid string, name string, data string)
- func (m *Email) GetBccs() []*mail.Address
- func (m *Email) GetCcs() []*mail.Address
- func (m *Email) GetDate() time.Time
- func (m *Email) GetFrom() *mail.Address
- func (m *Email) GetRecipients() []string
- func (m *Email) GetRecipientsByDomain() map[string][]string
- func (m *Email) GetReplys() []*mail.Address
- func (m *Email) GetSender() string
- func (m *Email) GetTos() []*mail.Address
- func (m *Email) SetFrom(s string) error
- func (m *Email) SetHTMLMsg(msg string)
- func (m *Email) SetSender(s string) error
- func (m *Email) SetTextMsg(msg string)
- type SMTPSender
- type Sender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attachment ¶
Attachment email attachment
func NewAttachment ¶
NewAttachment new a email attachment
func (*Attachment) IsInline ¶
func (a *Attachment) IsInline() bool
IsInline return true if cid is not empty
type DirectSender ¶
type DirectSender struct {
Sender
}
DirectSender direct send email
func (*DirectSender) DirectSend ¶
func (ds *DirectSender) DirectSend(ms ...*Email) error
DirectSend lookup MX record and direct send to recipter's mail server
type Email ¶
type Email struct {
MsgID string
Date time.Time
Subject string
Message string
HTML bool
Attachments []*Attachment
DkimDomain string
DkimSelector string
DkimPrivateKey string
// contains filtered or unexported fields
}
Email email struct
func (*Email) AddAttachment ¶
func (m *Email) AddAttachment(as ...*Attachment)
AddAttachment add a attachment
func (*Email) AttachFile ¶
AttachFile attach a file
func (*Email) AttachString ¶
AttachString attach a string date file
func (*Email) EmbedString ¶
EmbedString embed a string date file
func (*Email) GetRecipients ¶
GetRecipients get all recipients
func (*Email) GetRecipientsByDomain ¶
GetRecipientsByDomain return a (domain => address string array) map
type SMTPSender ¶
type SMTPSender struct {
// Host represents the host of the SMTP server.
Host string
// Port represents the port of the SMTP server.
Port int
// Username is the username to use to authenticate to the SMTP server.
Username string
// Password is the password to use to authenticate to the SMTP server.
Password string
// Auth represents the authentication mechanism used to authenticate to the
// SMTP server.
Auth smtp.Auth
Sender
}
SMTPSender SMTP email sender
func (*SMTPSender) Dial ¶
func (ss *SMTPSender) Dial() error
Dial dials and authenticates to an SMTP server. Should call Close() when done.
func (*SMTPSender) DialAndSend ¶
func (ss *SMTPSender) DialAndSend(ms ...*Email) error
DialAndSend opens a connection to the SMTP server, sends the given emails and closes the connection.
func (*SMTPSender) Send ¶
func (ss *SMTPSender) Send(ms ...*Email) error
Send send mail to SMTP server.
type Sender ¶
type Sender struct {
// LocalName is the hostname sent to the SMTP server with the HELO command.
// By default, "localhost" is sent.
Helo string
// Timeout timeout when connect to the SMTP server
Timeout time.Duration
// SSL defines whether an SSL connection is used. It should be false in
// most cases since the authentication mechanism should use the STARTTLS
// extension instead.
SSL bool
// SkipTLS Skip StartTLS when the STARTTLS extension is used
SkipTLS bool
// TSLConfig represents the TLS configuration used for the TLS (when the
// STARTTLS extension is used) or SSL connection.
TLSConfig *tls.Config
// ConnDebug a conn wrap func
ConnDebug func(conn net.Conn) net.Conn
// DataDebug a data writer wrap func
DataDebug func(w io.Writer) io.Writer
// contains filtered or unexported fields
}
Sender email sender