Postal-Go: This is a client library for sending emails through Postal

  • By Sarat Chandra
  • Last update: May 19, 2022
  • Comments: 0

Postal-Go

This is a client library for sending emails through Postal.

Uses the Send a raw RFC2882 message api.

Usage

client, err := NewAPIClient(postalAddr, postalToken, &http.Client{
	Timeout: 10 * time.Second,
})
if err != nil {
	log.Fatalf("error creating api client: %v", err)
}

msg := Message{
	From:      fromAddr,
	To:        []string{toAddr},
	Subject:   "Test Email",
	PlainBody: "Test Email from postal_go",
}
if err := msg.AttachFile("test/hello.txt"); err != nil {
	log.Fatalf("error attaching file: %s", err)
}

resp, err := client.SendMessage(msg)
if err != nil {
	log.Fatalf("error from send message: %v", err)
}

Docs

See the docs at Godoc.

Download

postal_go.zip