Documentation
¶
Overview ¶
Package mailer provides an abstraction for sending HTML emails It supports multiple sending backends (SMTP, API-based services), asynchronous sending, retry logic, and fallback to logging when no email provider is configured.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mailer ¶
type Mailer interface {
SendRequestAuth(ctx context.Context, to, otp string) error
SendAccountApproved(ctx context.Context, to string) error
SendAccountBlocked(ctx context.Context, to string) error
SendAccountReactivated(ctx context.Context, to string) error
}
Mailer defines the interface for sending templated emails.
type NoOpTransport ¶
type NoOpTransport struct {
// contains filtered or unexported fields
}
NoOpTransport is a no-op transport that logs emails instead of sending them.
func NewNoOpTransport ¶
func NewNoOpTransport(sender, replyTo string) (*NoOpTransport, error)
NewNoOpTransport creates a new no-op transport.
type ResendError ¶
ResendError represents an error returned by the Resend API.
func (*ResendError) Error ¶
func (e *ResendError) Error() string
type ResendSender ¶
type ResendSender struct {
// contains filtered or unexported fields
}
ResendSender sends emails via the Resend API.
func NewResendSender ¶
func NewResendSender(apiKey, sender, replyTo string) (*ResendSender, error)
NewResendSender creates a new Resend sender with the given API key. Returns an error if the API key is empty.
type SMTPSender ¶
type SMTPSender struct {
// contains filtered or unexported fields
}
SMTPSender sends emails via SMTP.
func NewSMTPSender ¶
func NewSMTPSender(address, user, password, sender, replyTo string) (*SMTPSender, error)
NewSMTPSender creates a new SMTP sender with the given configuration.