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 ¶
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(cfg MailgunConfig) *MailgunClient
NewMailgunClient creates a MailgunClient from a MailgunConfig. 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 MailgunConfig ¶ added in v0.3.2
MailgunConfig holds the configuration for a MailgunClient. The consuming service populates it, typically from its appconfig tree.
func (MailgunConfig) LogValue ¶ added in v0.3.2
func (c MailgunConfig) LogValue() slog.Value
LogValue implements slog.LogValuer, redacting the password.