Documentation
¶
Overview ¶
//////////////////////////////////////////////////////////////////// mail.go ////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////// smtp_client.go ////////////////////////////////////////////////////////////////////
Index ¶
- Constants
- func SetFuncMapSafeHtml(f template.FuncMap)
- type Attachment
- type AuthConfig
- type Body
- type CRAMMD5Auth
- type PlainAuth
- type SmtpClient
- func (c *SmtpClient) AppendAttachment(base64EncodedData, contentType, fileName string) *SmtpClient
- func (c *SmtpClient) AppendBcc(bcc string) *SmtpClient
- func (c *SmtpClient) AppendCc(cc string) *SmtpClient
- func (c *SmtpClient) AppendTo(to string) *SmtpClient
- func (c *SmtpClient) Send() error
- func (c *SmtpClient) SetAuthCramMd5(userName, secret string) *SmtpClient
- func (c *SmtpClient) SetAuthPlain(userName, password, host string) *SmtpClient
- func (c *SmtpClient) SetBodyHtmlFromFiles(charset string, fileNames []string, params map[string]interface{}, ...) error
- func (c *SmtpClient) SetBodyHtmlFromStr(charset string, text string, params map[string]interface{}, ...) error
- func (c *SmtpClient) SetBodyTextFromFiles(charset string, fileNames []string, params map[string]interface{}, ...) error
- func (c *SmtpClient) SetBodyTextFromStr(charset string, text string, params map[string]interface{}, ...) error
- func (c *SmtpClient) SetCertBytes(certPem []byte, keyPem []byte) error
- func (c *SmtpClient) SetCertFiles(certFile string, keyFile string) error
- func (c *SmtpClient) SetFromName(name string) *SmtpClient
- func (c *SmtpClient) SetTlsConfig(serverName string) *SmtpClient
Constants ¶
const ( CHARSET_ISO_2022_JP = "iso-2022-jp" CHARSET_US_ASCII = "us-ascii" CHARSET_UTF8 = "UTF-8" CONTENT_TYPE_TEXT_HTML = "text/html" CONTENT_TYPE_TEXT_PLAIN = "text/plain" CONTENT_TYPE_TEXT_RICHTEXT = "text/richtext" CONTENT_TYPE_TEXT_X_WHATEVER = "text/x-whatever" MIME_VERSION_1_0 = "1.0" )
Variables ¶
This section is empty.
Functions ¶
func SetFuncMapSafeHtml ¶
//////////////////////////////////////////////////////////////////// Set funcMap for SafeHtml. ////////////////////////////////////////////////////////////////////
Types ¶
type Attachment ¶
type AuthConfig ¶
type AuthConfig struct { Crammd5Auth *CRAMMD5Auth PlainAuth *PlainAuth }
type CRAMMD5Auth ¶
type SmtpClient ¶
type SmtpClient struct { Attachments []*Attachment AuthConfig *AuthConfig Bcc []string BodyHtml *Body BodyText *Body Cc []string FromEmail string FromName string Host string MimeVersion string Port int Rcpts []string Subject string TlsConfig *tls.Config To []string }
func NewSmtpClient ¶
func NewSmtpClient(host string, port int, fromEmail, toEmail, subject string) *SmtpClient
//////////////////////////////////////////////////////////////////// New SmtpClient. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) AppendAttachment ¶
func (c *SmtpClient) AppendAttachment(base64EncodedData, contentType, fileName string) *SmtpClient
//////////////////////////////////////////////////////////////////// Append an attachment. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) AppendBcc ¶
func (c *SmtpClient) AppendBcc(bcc string) *SmtpClient
//////////////////////////////////////////////////////////////////// Append an email into bcc. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) AppendCc ¶
func (c *SmtpClient) AppendCc(cc string) *SmtpClient
//////////////////////////////////////////////////////////////////// Append an email into cc. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) AppendTo ¶
func (c *SmtpClient) AppendTo(to string) *SmtpClient
//////////////////////////////////////////////////////////////////// Append an email into to. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) Send ¶
func (c *SmtpClient) Send() error
//////////////////////////////////////////////////////////////////// Send Email ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetAuthCramMd5 ¶
func (c *SmtpClient) SetAuthCramMd5(userName, secret string) *SmtpClient
//////////////////////////////////////////////////////////////////// Set SMTP auth for CRAM-MD5. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetAuthPlain ¶
func (c *SmtpClient) SetAuthPlain(userName, password, host string) *SmtpClient
//////////////////////////////////////////////////////////////////// Set SMTP auth for PLAIN. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetBodyHtmlFromFiles ¶
func (c *SmtpClient) SetBodyHtmlFromFiles(charset string, fileNames []string, params map[string]interface{}, funcMap template.FuncMap) error
//////////////////////////////////////////////////////////////////// Set SMTP body HTML from files. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetBodyHtmlFromStr ¶
func (c *SmtpClient) SetBodyHtmlFromStr(charset string, text string, params map[string]interface{}, funcMap template.FuncMap) error
//////////////////////////////////////////////////////////////////// Set SMTP body HTML from string. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetBodyTextFromFiles ¶
func (c *SmtpClient) SetBodyTextFromFiles(charset string, fileNames []string, params map[string]interface{}, funcMap template.FuncMap) error
//////////////////////////////////////////////////////////////////// Set SMTP body text from files. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetBodyTextFromStr ¶
func (c *SmtpClient) SetBodyTextFromStr(charset string, text string, params map[string]interface{}, funcMap template.FuncMap) error
//////////////////////////////////////////////////////////////////// Set SMTP body text from string. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetCertBytes ¶
func (c *SmtpClient) SetCertBytes(certPem []byte, keyPem []byte) error
//////////////////////////////////////////////////////////////////// Set certificate bytes into the TLS config. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetCertFiles ¶
func (c *SmtpClient) SetCertFiles(certFile string, keyFile string) error
//////////////////////////////////////////////////////////////////// Set certificate files into the TLS config. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetFromName ¶
func (c *SmtpClient) SetFromName(name string) *SmtpClient
//////////////////////////////////////////////////////////////////// Set SMTP from name. ////////////////////////////////////////////////////////////////////
func (*SmtpClient) SetTlsConfig ¶
func (c *SmtpClient) SetTlsConfig(serverName string) *SmtpClient
//////////////////////////////////////////////////////////////////// Set SMTP TLS. ////////////////////////////////////////////////////////////////////