Skip to content

Latest commit

 

History

History
31 lines (27 loc) · 600 Bytes

File metadata and controls

31 lines (27 loc) · 600 Bytes

Emailer

A pretty wrapper around go net/smtp send multiple email using single client

func main() {
  var client *emailer.Client
  client, err := emailer.NewClient(Options{
		Host: "smtp-test.example.com",
		Port: "1025",
		User: "username",
		Pass: "password",
		Name: "Example User",
		From: "user@example.com",
	})
	if err != nil {
		log.Fatal("Could not initialize client Emailer")
	}

 	var buf bytes.Buffer
	buf.WriteString("Test message content")

	mail := emailer.Mail{
		To:      []string{"test@user.com"},
		Subject: "Test subject",
		Body:    buf,
	}
	mail.SendWith(client)
}