Documentation ¶
Index ¶
- func LoginAuth(username, password string) smtp.Auth
- func MailAddr(name string, address string) *mail.Address
- func SendMail(subject string, content string, receiver, sender string, bcc []string, ...) error
- type Attachments
- type Mail
- func (m *Mail) AddAttachment(filePath string) error
- func (m *Mail) AddBCC(email string) error
- func (m *Mail) AddDate(date string)
- func (m *Mail) AddFrom(from string) error
- func (m *Mail) AddFromName(name string)
- func (m *Mail) AddHTML(html string)
- func (m *Mail) AddHeaders(headers string)
- func (m *Mail) AddRecipient(receipient *mail.Address)
- func (m *Mail) AddRecipientBCC(email *mail.Address)
- func (m *Mail) AddReplyTo(reply string)
- func (m *Mail) AddSubject(s string)
- func (m *Mail) AddText(text string)
- func (m *Mail) AddTo(email string) error
- func (m *Mail) AddToName(name string)
- func (m *Mail) ReadAttachment(filePath string) (string, error)
- func (m *Mail) SetTos(emails []string)
- type SMTPClient
- type SMTPConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendMail ¶
func SendMail(subject string, content string, receiver, sender string, bcc []string, smtpConfig *SMTPConfig, attachments *Attachments) error
SendMail 发送电邮
Types ¶
type Attachments ¶
type Mail ¶
type Mail struct { To []string ToName []string Subject string HTML string Text string From string Bcc []string FromName string ReplyTo string Date string Files map[string]string Headers string BaseDir string //内容中图片路径 Charset string //编码 RetReceipt string //回执地址,空白则禁用回执 }
Mail will represent a formatted email
func (*Mail) AddAttachment ¶
AddAttachment will include file/s in mail
func (*Mail) AddFromName ¶
AddFromName will set the senders name
func (*Mail) AddHeaders ¶
AddHeaders addding header string
func (*Mail) AddRecipient ¶
AddRecipient will take an already parsed mail.Address
func (*Mail) AddRecipientBCC ¶
AddRecipientBCC works like AddRecipient but for BCC
func (*Mail) AddReplyTo ¶
AddReplyTo will set the return address
func (*Mail) AddSubject ¶
AddSubject will set the subject of the mail
func (*Mail) AddTo ¶
AddTo will take a valid email address and store it in the mail. It will return an error if the email is invalid.
func (*Mail) ReadAttachment ¶
ReadAttachment reading attachment
type SMTPClient ¶
type SMTPClient struct {
// contains filtered or unexported fields
}
SMTPClient struct
func NewSMTPClient ¶
func NewSMTPClient(conf *SMTPConfig) SMTPClient
func (*SMTPClient) Send ¶
func (c *SMTPClient) Send(m Mail) error
Send - It can be used for generic SMTP stuff
Click to show internal directories.
Click to hide internal directories.