Documentation
¶
Overview ¶
Package email provides an abstraction layer for sending emails with support for multiple providers (SMTP, SendGrid, AWS SES, etc.)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSSESConfig ¶
type AWSSESConfig struct {
Region string // AWS region
AccessKeyID string // AWS access key ID
SecretAccessKey string // AWS secret access key
ConfigSetName string // Optional configuration set name
}
AWSSESConfig contains AWS SES-specific configuration
type Attachment ¶
type Attachment struct {
Filename string // Filename to display
Content []byte // File content
ContentType string // MIME type
}
Attachment represents an email attachment
type Client ¶
type Client interface {
// Send sends an email message
Send(ctx context.Context, msg *Message) (*SendResult, error)
// SendBulk sends multiple emails in batch
SendBulk(ctx context.Context, messages []*Message) ([]*SendResult, error)
// ValidateAddress checks if an email address is valid
ValidateAddress(email string) error
// Close closes the email client and releases resources
Close() error
}
Client is the interface that all email providers must implement
type Config ¶
type Config struct {
Provider Provider // Email provider to use
From string // Default sender address
Options map[string]string // Provider-specific options
}
Config contains configuration for email client
type MailgunConfig ¶
type MailgunConfig struct {
Domain string // Mailgun domain
APIKey string // Mailgun API key
PublicKey string // Mailgun public key
BaseURL string // Mailgun API base URL (optional)
}
MailgunConfig contains Mailgun-specific configuration
type Message ¶
type Message struct {
From string // Sender email address
To []string // Recipient email addresses
CC []string // Carbon copy recipients
BCC []string // Blind carbon copy recipients
Subject string // Email subject
Body string // Email body (plain text or HTML)
HTML bool // Whether body is HTML
Attachments []Attachment // File attachments
Headers map[string]string // Custom email headers
ReplyTo string // Reply-to address
Priority Priority // Email priority
}
Message represents an email message
func (*Message) AddAttachment ¶
AddAttachment adds a file attachment to the message
type Provider ¶
type Provider string
Provider represents an email service provider
const ( // ProviderSMTP uses standard SMTP protocol ProviderSMTP Provider = "smtp" // ProviderSendGrid uses SendGrid API ProviderSendGrid Provider = "sendgrid" // ProviderAWSSES uses AWS Simple Email Service ProviderAWSSES Provider = "aws_ses" // ProviderMailgun uses Mailgun API ProviderMailgun Provider = "mailgun" )
type SMTPConfig ¶
type SMTPConfig struct {
Host string // SMTP server hostname
Port int // SMTP server port
Username string // SMTP username
Password string // SMTP password
UseTLS bool // Whether to use TLS
}
SMTPConfig contains SMTP-specific configuration
type SendGridConfig ¶
type SendGridConfig struct {
APIKey string // SendGrid API key
}
SendGridConfig contains SendGrid-specific configuration