Documentation ¶
Overview ¶
Package email simple email sender
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mail ¶
type Mail interface { // Login login to SMTP server Login(username, password string) // Send send email Send(frAddr, toAddr, frName, toName, subject, content string, optfs ...SendOption) (err error) }
Mail is a simple email sender
Example ¶
sender := NewMail("smtp_host", 53) if err := sender.Send( "fromAddr", "toAddr", "frName", "toName", "Title", "Content", ); err != nil { log.Shared.Error("try to send email got error", zap.Error(err)) }
Output:
type MailT ¶ added in v3.1.0
type MailT struct {
// contains filtered or unexported fields
}
MailT easy way to send basic email
func (*MailT) BuildMessage ¶ added in v3.1.0
BuildMessage implement
type SendOption ¶
type SendOption func(*mailSendOpt)
SendOption is a function to set option for Mail.Send
func WithMailSendDialer ¶
func WithMailSendDialer(dialerFact func(host string, port int, username, passwd string) Sender) SendOption
WithMailSendDialer set gomail.Dialer
Click to show internal directories.
Click to hide internal directories.