mailgun

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2019 License: MIT Imports: 11 Imported by: 0

README

mailgun

GoDoc

Wraps the official client to provide unit test utilities and simplify the usage.

Basic usage
import (
  "libs.altipla.consulting/mailgun"
)

Documentation

Overview

Package mailgun wraps the official client to provide unit test utilities and simplify the usage.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout = fmt.Errorf("mailgun: timeout")
)

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Filename string
	Content  []byte
}

type Client

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

func NewClient

func NewClient(apiKey string) *Client

func (*Client) Send

func (client *Client) Send(ctx context.Context, domain string, email *Email) error

func (*Client) ValidateEmail

func (client *Client) ValidateEmail(ctx context.Context, email string) (bool, error)

type Email

type Email struct {
	From        mail.Address
	To          mail.Address
	Subject     string
	HTML        string
	Tags        []string
	ReplyTo     string
	Attachments []*Attachment
}

type InvalidToEmailError added in v1.9.0

type InvalidToEmailError struct {
	Email string
}

func (InvalidToEmailError) Error added in v1.9.0

func (err InvalidToEmailError) Error() string

type SendRejectedError

type SendRejectedError struct {
	Reason string
}

func (SendRejectedError) Error

func (err SendRejectedError) Error() string

type Sender

type Sender interface {
	Send(ctx context.Context, domain string, email *Email) error
}

type Validator

type Validator interface {
	ValidateEmail(ctx context.Context, email string) (bool, error)
}

Jump to

Keyboard shortcuts

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