Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Latest commit

 

History

History
50 lines (38 loc) · 1.29 KB

README.md

File metadata and controls

50 lines (38 loc) · 1.29 KB

Go Postmark library

This library should provide everything you need to send e-mails using the Postmark API.

Important: Work in progress! You shouldn't rely on this for important e-mails. As I currently don't handle the API response, the server.Send methods could change in the future in order to return more information.

Works

  • Sending text and HTML e-mail without attachments.
  • Errors based on HTTP response codes.

Roadmap

  • Attachments
  • Use Url Fetch API when running on Google App Engine.
  • Batch sending
  • Handling Postmark API response and errors.

Example

Sending a simple text/plain e-mail:

server := postmark.NewServer("api-key-here")
	
err := server.SendSimpleText("[email protected]","[email protected]", "Example e-mail", "Hello there, this is an example e-mail!")

if err != nil {
	fmt.Println(err)
}

You can also use the Message object directly if you need more options:

server := postmark.NewServer("api-key-here")

message := postmark.NewMessage()
message.To = "[email protected]"
message.From = "[email protected]"
message.ReplyTo = "[email protected]"
message.Tag = "signup"
message.TextBody = "Hello there, this is an example e-mail!")

err := server.Send(message)

if err != nil {
	fmt.Println(err)
}