Documentation ¶
Overview ¶
Package postmark provides a convenient wrapper for the Postmark API
Index ¶
Examples ¶
Constants ¶
View Source
const (
DefaultHost = "api.postmarkapp.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
func (*Attachment) MarshalJSON ¶
func (a *Attachment) MarshalJSON() ([]byte, error)
type Client ¶
type Client struct { ApiKey string Secure bool Host string // Host for the API endpoints, DefaultHost if "" }
Example ¶
package main import ( "fmt" "net/mail" "strings" "github.com/hjr265/postmark.go/postmark" ) func main() { c := postmark.Client{ ApiKey: "YOUR-API-KEY", Secure: true, } res, err := c.Send(&postmark.Message{ From: &mail.Address{ Name: "SENDER-NAME", Address: "SENDER-EMAIL", }, To: []*mail.Address{ { Name: "RECIPIENT NAME", Address: "RECIPIENT EMAIL", }, }, Subject: "SUBJECT", TextBody: strings.NewReader("MESSAGE-BODY-AS-TEXT"), }) if err != nil { panic(err) } fmt.Printf("%#v\n", res) }
Output:
type Message ¶
type Message struct { From *mail.Address To []*mail.Address Cc []*mail.Address Bcc []*mail.Address Subject string Tag string HtmlBody io.Reader TextBody io.Reader TemplateId int TemplateModel map[string]interface{} ReplyTo *mail.Address Headers mail.Header Attachments []Attachment TrackOpens bool TrackLinks bool }
func (*Message) MarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.