Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentType ¶
type ContentType string
ContentType represents the content type of a mail message.
const ( // ContentTypeTextPlain represents a plain text content type. ContentTypeTextPlain ContentType = "text/plain" // ContentTypeTextHTML represents a HTML content type. ContentTypeTextHTML ContentType = "text/html" )
type MailConfig ¶
type MailConfig struct { From string Username string Password string Port int Host string ForceTLS bool }
MailConfig represents the configuration for the mail server.
type MailMessage ¶
type MailMessage struct { To []string Subject string ContentType ContentType Body string }
Mail represents a mail message.
type Mailer ¶
type Mailer struct { Config *MailConfig Client *mail.Client }
Mailer represents a mailer client.
func NewMailer ¶
func NewMailer(config *MailConfig) (*Mailer, error)
NewMailer creates a new mailer client and connects to the mail server.
func (*Mailer) SendMail ¶
func (m *Mailer) SendMail(message *MailMessage) error
SendMail sends a given mail message.
func (*Mailer) SendMailWithContext ¶
func (m *Mailer) SendMailWithContext(message *MailMessage, context context.Context) error
SendMailWithContext sends a given mail message with a given context.
Click to show internal directories.
Click to hide internal directories.