Documentation ¶
Overview ¶
Send basic messages over SMTP
Index ¶
- type Mail
- func (mail Mail) SendContext(ctx context.Context, data []byte, subject, contentType string, to []string) error
- func (mail Mail) SendText(subject, text string) error
- func (mail Mail) SendTextContext(ctx context.Context, subject, text string) error
- func (mail Mail) SendTextTo(subject, text string, to []string) error
- func (mail Mail) SendTextToContext(ctx context.Context, subject, text string, to []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mail ¶
type Mail struct { Server string `env:"MAIL_SERVER"` // SMTP server (mandatory) TLS bool `env:"MAIL_TLS"` // Enable TLS connection Login string `env:"MAIL_LOGIN"` // Login name and sender email (mandatory) Password string `env:"MAIL_PASSWORD"` // Send password (if no password defined, AUTH will not be used) To []string `env:"MAIL_TO" envSeparator:":"` // Default receivers }
Mail configuration
func Default ¶
func Default() *Mail
Default mail configuration from env variables
MAIL_SERVER - mandatory, address with port (usually: 25 for non-TLS, 465 for TLS) of SMTP server MAIL_LOGIN - mandatory, login/sender email address
func (Mail) SendContext ¶
func (mail Mail) SendContext(ctx context.Context, data []byte, subject, contentType string, to []string) error
Send arbitrary content over SMTP server. Addresses will be visible in To header
func (Mail) SendTextContext ¶
Send plain/text message to default addresses (see SendTextToContext)
func (Mail) SendTextTo ¶
Send plain/text message to custom addresses (see SendTextToContext)
Click to show internal directories.
Click to hide internal directories.