mailgun

package module
v0.0.0-...-6c68751 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2014 License: MIT Imports: 14 Imported by: 6

README

go-mailgun

Mailgun client in Go. API doc http://godoc.org/github.com/riobard/go-mailgun

Documentation

Overview

Mailgun client in Go.

Index

Constants

View Source
const (
	API_VERSION  = 2
	API_ENDPOINT = "api.mailgun.net"
)
View Source
const MAX_FORM_SIZE = 2 * 1024 * 1024

Variables

View Source
var (
	ErrMethodNotAllowed = fmt.Errorf("method not allowed")
	ErrBadSignature     = fmt.Errorf("bad signature")
	ErrInvalidTimestamp = fmt.Errorf("invalid timestamp")
	ErrInvalidForm      = fmt.Errorf("invalid form data")
)
View Source
var EMAIL_DOMAIN_RE = regexp.MustCompile(`[^<>]+<?.+@([^<>]+)>?`)

Functions

This section is empty.

Types

type Bounce

type Bounce struct {
	Code      int    `json:"code"`
	CreatedAt string `json:"created_at"`
	Error     string `json:"error"`
	Address   string `json:"address"`
}

func (*Bounce) Time

func (b *Bounce) Time() time.Time

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(key string) *Client

func (*Client) AddListMember

func (c *Client) AddListMember(list string, m ListMember) (message string, err error)

func (*Client) Bounces

func (c *Client) Bounces(domain string, limit, skip int) (total int, res []Bounce, err error)

func (*Client) Complaints

func (c *Client) Complaints(domain string, limit, skip int) (total int, res []Complaint, err error)

func (*Client) Create

func (c *Client) Create(r *Route) (routeId string, err error)

func (*Client) Delete

func (c *Client) Delete(r *Route) (err error)

func (*Client) Get

func (c *Client) Get(routeId string) (r Route, err error)

func (*Client) GetListMember

func (c *Client) GetListMember(list string, email string) (member ListMember, err error)

func (*Client) Logs

func (c *Client) Logs(domain string, limit, skip int) (total int, res []Log, err error)

func (*Client) Routes

func (c *Client) Routes(limit, skip int) (total int, res []Route, err error)

func (*Client) Send

func (c *Client) Send(m Mail) (msgId string, err error)

func (*Client) Stats

func (c *Client) Stats(domain string, limit, skip int, events []string, startDate time.Time) (total int, res []Stat, err error)

func (*Client) Update

func (c *Client) Update(r *Route) (routeId string, err error)

func (*Client) UpdateListMember

func (c *Client) UpdateListMember(list string, m ListMember) (message string, err error)

type Complaint

type Complaint struct {
	Count     int    `json:"count"`
	CreatedAt string `json:"created_at"`
	Address   string `json:"address"`
}

func (*Complaint) Time

func (c *Complaint) Time() time.Time

type Event

type Event struct {
	// contains filtered or unexported fields
}

func (*Event) MsgId

func (e *Event) MsgId() string

func (*Event) Name

func (e *Event) Name() string

func (*Event) Rcpt

func (e *Event) Rcpt() string

func (*Event) Reason

func (e *Event) Reason() string

func (*Event) Time

func (e *Event) Time() time.Time

type ListMember

type ListMember struct {
	Address     string            `json:address`
	Subscribed  bool              `json:subscribed`
	Vars        map[string]string `json:vars`
	Name        string            `json:name`
	Description string            `json:description`
}

type ListMemberResponse

type ListMemberResponse struct {
	Member  ListMember `json:member`
	Message string     `json:message`
}

type Log

type Log struct {
	Hap       string `json:"hap"`
	CreatedAt string `json:"created_at"`
	Message   string `json:"message"`
	Type      string `json:"type"`
	MessageId string `json:"message_id"`
}

func (*Log) Time

func (l *Log) Time() time.Time

type Mail

type Mail interface {
	From() string
	To() []string
	Cc() []string
	Bcc() []string
	Subject() string
	Html() string
	Text() string
	Headers() map[string]string
	Options() map[string]string
	Variables() map[string]string
}

type Route

type Route struct {
	Id          string   `json:"id"`
	Priority    int      `json:"priority"`
	Description string   `json:"description"`
	Expression  string   `json:"expression"`
	Actions     []string `json:"actions"`
}

type Stat

type Stat struct {
	Count     int            `json:"total_count"`
	CreatedAt string         `json:"created_at"`
	Tags      map[string]int `json:"tags"`
	Id        string         `json:"id"`
	Event     string         `json:"event"`
}

func (*Stat) Time

func (s *Stat) Time() time.Time

type Webhook

type Webhook struct {
	// contains filtered or unexported fields
}

func NewWebhook

func NewWebhook(key string) *Webhook

func (*Webhook) Handle

func (wh *Webhook) Handle(w http.ResponseWriter, req *http.Request) (evt *Event, err error)

func (*Webhook) Verify

func (wh *Webhook) Verify(timestamp, token, signature string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL