mailgun

package
v0.0.0-...-0941746 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Tag the received message with headers providing a measure of its spamness.
	SpamActionTag = SpamAction("tag")
	// Prevents Mailgun from taking any action on what it perceives to be spam.
	SpamActionDisabled = SpamAction("disabled")
	// instructs Mailgun to just block or delete the message all-together.
	SpamActionDelete = SpamAction("delete")

	DKIMKeySize1024 = 1024
	DKIMKeySize2048 = 2048
)

Use these to specify a spam action when creating a new domain.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(apiKey string, httpClient *http.Client) *Client

func (*Client) CreateDomain

func (client *Client) CreateDomain(ctx context.Context, input CreateDomainInput) (res Domain, err error)

func (*Client) DeleteDomain

func (client *Client) DeleteDomain(ctx context.Context, domain string) (err error)

func (*Client) GetDomain

func (client *Client) GetDomain(ctx context.Context, domain string) (res DomainResponse, err error)

func (*Client) UpdateDomainDKIMSelector

func (client *Client) UpdateDomainDKIMSelector(ctx context.Context, input UpdateDomainDKIMSelectorInput) (err error)

type CreateDomainInput

type CreateDomainInput struct {
	Name               string      `json:"name"`
	SMTPPassword       *string     `json:"smtp_password"`
	SpamAction         *SpamAction `json:"spam_action"`
	Wildcard           *bool       `json:"wildcard"`
	ForceDKIMAuthority *bool       `json:"force_dkim_authority"`
	DKIMKeySize        *int        `json:"dkim_key_size"`
	IPS                []string    `json:"ips"`
	PoolID             *string     `json:"pool_id"`
	WebScheme          *string     `json:"web_scheme"`
}

Optional parameters when creating a domain

type DNSRecord

type DNSRecord struct {
	Priority   string
	RecordType string `json:"record_type"`
	Valid      string
	Name       string
	Value      string
}

DNSRecord structures describe intended records to properly configure your domain for use with Mailgun. Note that Mailgun does not host DNS records.

type Domain

type Domain struct {
	CreatedAt    RFC2822Time `json:"created_at"`
	SMTPLogin    string      `json:"smtp_login"`
	Name         string      `json:"name"`
	SMTPPassword string      `json:"smtp_password"`
	Wildcard     bool        `json:"wildcard"`
	SpamAction   SpamAction  `json:"spam_action"`
	State        string      `json:"state"`
}

A Domain structure holds information about a domain used when sending mail.

type DomainConnection

type DomainConnection struct {
	RequireTLS       bool `json:"require_tls"`
	SkipVerification bool `json:"skip_verification"`
}

Specify the domain connection options

type DomainResponse

type DomainResponse struct {
	Domain              Domain      `json:"domain"`
	ReceivingDNSRecords []DNSRecord `json:"receiving_dns_records"`
	SendingDNSRecords   []DNSRecord `json:"sending_dns_records"`
}

type DomainTracking

type DomainTracking struct {
	Click       TrackingStatus `json:"click"`
	Open        TrackingStatus `json:"open"`
	Unsubscribe TrackingStatus `json:"unsubscribe"`
}

Specify the domain tracking options

type RFC2822Time

type RFC2822Time time.Time

Mailgun uses RFC2822 format for timestamps everywhere ('Thu, 13 Oct 2011 18:02:00 GMT'), but by default Go's JSON package uses another format when decoding/encoding timestamps.

func NewRFC2822Time

func NewRFC2822Time(str string) (RFC2822Time, error)

func (RFC2822Time) IsZero

func (t RFC2822Time) IsZero() bool

func (RFC2822Time) MarshalJSON

func (t RFC2822Time) MarshalJSON() ([]byte, error)

func (RFC2822Time) String

func (t RFC2822Time) String() string

func (RFC2822Time) Unix

func (t RFC2822Time) Unix() int64

func (*RFC2822Time) UnmarshalJSON

func (t *RFC2822Time) UnmarshalJSON(s []byte) error

type SpamAction

type SpamAction string

type TrackingStatus

type TrackingStatus struct {
	Active     bool   `json:"active"`
	HTMLFooter string `json:"html_footer"`
	TextFooter string `json:"text_footer"`
}

The tracking status of a domain

type UpdateDomainDKIMSelectorInput

type UpdateDomainDKIMSelectorInput struct {
	Domain       string `json:"-"`
	DKIMSelector string `json:"dkim_selector"`
}

Jump to

Keyboard shortcuts

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