mailgun

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package mailgun implements mailer.Sender on the Mailgun HTTP API (v3) with no dependency beyond the standard library.

Index

Constants

View Source
const (
	// DefaultBaseURL serves US-region domains. EU-region domains must use
	// WithBaseURL(EUBaseURL).
	DefaultBaseURL = "https://api.mailgun.net"
	EUBaseURL      = "https://api.eu.mailgun.net"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client sends messages through a single Mailgun domain. It is safe for concurrent use.

func New

func New(domain, apiKey string, opts ...Option) *Client

New returns a Client for the given sending domain and private API key.

func (*Client) Send

func (c *Client) Send(ctx context.Context, m *mailer.Message) (*mailer.Result, error)

Send posts the message to /v3/{domain}/messages as multipart form data.

type Option

type Option func(*Client)

Option configures a Client.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL overrides the API base URL (EU region, tests, proxy).

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

WithHTTPClient injects a custom *http.Client.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the HTTP client timeout.

Jump to

Keyboard shortcuts

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