Documentation ¶
Overview ¶
Package mailer provides functions to easily send emails.
This package should be used with or inside a package that helps writing emails like it is done in the package github.com/alexcesaro/mail/gomail
package main import ( "log" "net/mail" "strings" "github.com/alexcesaro/mail/mailer" ) func main() { msg := &mail.Message{ mail.Header{ "From": {"alex@example.com"}, "To": {"bob@example.com", "cora@example.com"}, "Subject": {"Hello!"}, "Content-Type": {"text/plain"}, }, strings.NewReader("Hello, how are you ?"), } m := mailer.NewMailer("smtp.example.com", "user", "123456", 25) if err := m.Send(msg); err != nil { // This will send the email to Bob and Cora log.Println(err) } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var SendMail = smtp.SendMail
Stubbed out for testing.
Functions ¶
This section is empty.
Types ¶
type Mailer ¶
type Mailer struct {
// contains filtered or unexported fields
}
A Mailer represents an SMTP server.
func NewCustomMailer ¶
NewCustomMailer creates a mailer using any authentication mechanism.
Click to show internal directories.
Click to hide internal directories.