types

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Filename    string `json:"filename"`
	ContentType string `json:"content_type"`
	Content     []byte `json:"content"`
	Inline      bool   `json:"inline,omitempty"`
}

Attachment represents an email attachment

type Message

type Message struct {
	From        string            `json:"from"`
	FromName    string            `json:"from_name"`
	To          []string          `json:"to"`
	Cc          []string          `json:"cc,omitempty"`
	Bcc         []string          `json:"bcc,omitempty"`
	Subject     string            `json:"subject"`
	HTMLBody    string            `json:"html_body,omitempty"`
	TextBody    string            `json:"text_body,omitempty"`
	Attachments []Attachment      `json:"attachments,omitempty"`
	Headers     map[string]string `json:"headers,omitempty"`
}

Message represents an email message

type Provider

type Provider interface {
	// Send sends an email message
	Send(ctx context.Context, message *Message) (*SendResult, error)

	// SendTemplate sends an email using a template (optional implementation)
	SendTemplate(ctx context.Context, template string, data interface{}, message *Message) (*SendResult, error)

	// GetProviderConfig returns the provider configuration
	GetProviderConfig() config.EmailProviderSettings

	// GetName returns the provider name
	GetName() string

	// GetType returns the provider type (smtp, sendgrid, ses, etc)
	GetType() string

	// IsHealthy checks if the provider is healthy/reachable
	IsHealthy(ctx context.Context) error

	// Close closes any resources held by the provider
	Close() error
}

Provider defines the interface that all email providers must implement

type SendResult

type SendResult struct {
	MessageID string `json:"message_id,omitempty"`
	Success   bool   `json:"success"`
	Error     string `json:"error,omitempty"`
}

SendResult represents the result of sending an email

Jump to

Keyboard shortcuts

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