resend

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package resend adapts the Resend API to the core email sender port.

New constructs a client from an API key, LoadConfig reads contrib environment configuration, and HealthChecker can be used by services that want readiness visibility for outbound email delivery.

Keep API keys in secret storage and use test or no-op senders in local tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthChecker

func HealthChecker(cfg Config, client *http.Client) ports.HealthChecker

HealthChecker returns a Resend health checker or nil when disabled.

Types

type Client

type Client struct {
	APIKey     string
	BaseURL    string
	HTTPClient *http.Client
}

Client implements email.Sender using the Resend API.

func New

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

New constructs a Resend API client.

func (*Client) Send

func (c *Client) Send(ctx context.Context, msg email.Message) (string, error)

Send sends an email via the Resend API.

type Config

type Config struct {
	Enabled   bool
	APIKey    string
	From      string
	ContactTo []string
	BaseURL   string
}

Config describes Resend email integration.

func LoadConfig

func LoadConfig(loader *config.Loader) Config

LoadConfig reads Resend config from environment.

type Option

type Option func(*Client)

Option customizes Client behavior.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL overrides the Resend API base URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient overrides the HTTP client used for requests.

Jump to

Keyboard shortcuts

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