email

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package email provides a Mailgun-backed email sender for transactional email delivery. It is intentionally dependency-free beyond the Go standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Filename    string
	ContentType string
	Data        []byte
	Inline      bool
}

Attachment describes a file to attach to an email. Data is raw file bytes.

type EmailMessage

type EmailMessage struct {
	From        string
	To          []string
	CC          []string
	BCC         []string
	Subject     string
	Text        string
	HTML        string
	Attachments []Attachment
}

EmailMessage represents an email to be sent.

type MailgunClient

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

MailgunClient sends emails via the Mailgun API.

func NewMailgunClient

func NewMailgunClient(endpoint, user, password string) *MailgunClient

NewMailgunClient creates a MailgunClient from plain credentials. The returned client uses a dedicated http.Client with a 30-second timeout and connection pooling.

func (*MailgunClient) Send

func (c *MailgunClient) Send(ctx context.Context, msg *EmailMessage) (string, error)

Send posts the email to Mailgun.

type Sender

type Sender interface {
	Send(ctx context.Context, msg *EmailMessage) (string, error)
}

Sender is the interface satisfied by MailgunClient. It enables mock injection in tests and decouples callers from the concrete implementation.

Jump to

Keyboard shortcuts

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