A Golang package for the using Postmark API.
go get -u github.com/keighl/postmark
Grab your Server Token, and your Account Token.
import (
"github.com/keighl/postmark"
)
client:=postmark.NewClient("[SERVER-TOKEN]", "[ACCOUNT-TOKEN]")
email:= postmark.Email{
From: "no-reply@example.com",
To: "tito@example.com",
Subject: "Reset your password",
HtmlBody: "...",
TextBody: "...",
Tag: "pw-reset",
TrackOpens: true,
}
_, err=client.SendEmail(email)
iferr!=nil {
panic(err)
}Swap out HTTPClient for use on Google App Engine:
import (
"github.com/keighl/postmark""google.golang.org/appengine""google.golang.org/appengine/urlfetch"
)
// ....client:=postmark.NewClient("[SERVER-TOKEN]", "[ACCOUNT-TOKEN]")
ctx:=appengine.NewContext(req)
client.HTTPClient=urlfetch.Client(ctx)
// ...- Emails
POST /emailPOST /email/batchPOST /email/withTemplatePOST /email/batchWithTemplates
- Bounces
GET /deliverystatsGET /bouncesGET /bounces/:idGET /bounces/:id/dumpPUT /bounces/:id/activateGET /bounces/tags
- Templates
GET /templatesPOST /templatesGET /templates/:idPUT /templates/:idDELETE /templates/:idPOST /templates/validate
- Servers
GET /servers/:idPUT /servers/:id
- Outbound Messages
GET /messages/outboundGET /messages/outbound/:id/detailsGET /messages/outbound/:id/dumpGET /messages/outbound/opensGET /messages/outbound/opens/:id
- Inbound Messages
GET /messages/inboundGET /messages/inbound/:id/detailsPUT /messages/inbound/:id/bypassPUT /messages/inbound/:id/retry
- Sender signatures
GET /senders- Get a sender signature’s details
- Create a signature
- Edit a signature
- Delete a signature
- Resend a confirmation
- Verify an SPF record
- Request a new DKIM
- Stats
GET /stats/outboundGET /stats/outbound/sendsGET /stats/outbound/bouncesGET /stats/outbound/spamGET /stats/outbound/trackedGET /stats/outbound/opensGET /stats/outbound/platform- Get email client usage
- Get email read times
- Triggers
- Tags triggers
- Create a trigger for a tag
- Get a single trigger
- Edit a single trigger
- Delete a single trigger
- Search triggers
- Inbound rules triggers
- Create a trigger for inbound rule
- Delete a single trigger
- List triggers
- Tags triggers
