Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyToAddress is returned when an "to" address is empty ErrEmptyToAddress = errors.New("invalid \"to\" address, cannot be empty") // ErrEmptyFromAddress is returned when an "from" address is empty ErrEmptyFromAddress = errors.New("invalid \"from\" address, cannot be empty") // ErrEmptyBody is returned when an HTML body and text body are empty ErrEmptyBody = errors.New("invalid body, both HTML body and text body cannot be empty") )
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
// Name of attachment
Name string `json:"Name"`
// Content of attachment
Content string `json:"Content"`
// Content type of attachment
ContentType string `json:"ContentType"`
// Content ID of attachment
ContentID string `json:"ContentID,omitempty"`
}
Attachment represents an email attachment
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages the request to the Postmark API
func (*Client) Email ¶
func (c *Client) Email(e Email) (resp EmailResponse, err error)
Email will send an email
Example ¶
var err error
e := MakeEmail("from@email.com", "to@email.com", "test email", "<p>Hello world</p>")
var resp EmailResponse
if resp, err = testClient.Email(e); err != nil {
log.Fatal(err)
}
fmt.Println("Response!", resp)
func (*Client) EmailWithTemplate ¶
func (c *Client) EmailWithTemplate(e EmailWithTemplate) (resp EmailResponse, err error)
Email will send an email
type Email ¶
type Email struct {
// Sender of email
From string `json:"From"`
// Receiver of email
To string `json:"To"`
// Additional public receivers of email
Cc string `json:"Cc"`
// Additional private receivers of email
Bcc string `json:"Bcc"`
// Email address to reply to
ReplyTo string `json:"ReplyTo"`
// Email subject
Subject string `json:"Subject,omitempty"`
// Email body as HTML
HTMLBody string `json:"HtmlBody,omitempty"`
// Email body as text
TextBody string `json:"TextBody,omitempty"`
TrackOpens bool `json:"TrackOpens"`
TrackLinks string `json:"TrackLinks,omitempty"`
Attachments []Attachment `json:"Attachments,omitempty"`
Headers []Header `json:"Headers,omitempty"`
Metadata *Metadata `json:"Metadata,omitempty"`
MessageStream string `json:"MessageStream,omitempty"`
Tag string `json:"Tag,omitempty"`
}
Email represents the request body for sending an email
type EmailResponse ¶
type EmailResponse struct {
// The "to" address of the Email
To string `json:"To"`
// Postmark Message ID for created Email
MessageID string `json:"MessageID"`
// Time at which the email send request was submitted (RFC3339)
SubmittedAt time.Time `json:"SubmittedAt"`
}
EmailResponse is the response from the Postmark API to an Email request
type EmailWithTemplate ¶
type Error ¶
type Error struct {
// ErrorCodes as specified within the Postmark API Documentation (https://postmarkapp.com/developer/api/overview#error-codes)
ErrorCode int64 `json:"ErrorCode"`
// Human-readable error message
Message string `json:"Message"`
}
Error represents an error response from the API
Click to show internal directories.
Click to hide internal directories.