Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Provider string // "sendgrid" or "resend"
SendGridAPIKey string // SendGrid API key
ResendAPIKey string // Resend API key
FromEmail string // From email address for all providers
}
Config are configurations options for the service
type EmailProvider ¶
type EmailProvider interface {
SendEmail(ctx context.Context, options SendOptions) error
}
EmailProvider defines the interface that all email providers must implement
type ProviderType ¶
type ProviderType string
ProviderType represents the available email providers
const ( ProviderSendGrid ProviderType = "sendgrid" ProviderResend ProviderType = "resend" )
Email provider constants
func ProviderTypeFrom ¶
func ProviderTypeFrom(s string) ProviderType
ProviderTypeFrom converts a string to a ProviderType, defaulting to SendGrid
type ResendProvider ¶
type ResendProvider struct {
// contains filtered or unexported fields
}
ResendProvider implements the EmailProvider interface for Resend
func NewResendProvider ¶
func NewResendProvider(apiKey, fromEmail string) *ResendProvider
NewResendProvider creates a new Resend email provider
func (*ResendProvider) SendEmail ¶
func (p *ResendProvider) SendEmail(ctx context.Context, options SendOptions) error
SendEmail sends an email using Resend
type SendGridProvider ¶
type SendGridProvider struct {
// contains filtered or unexported fields
}
SendGridProvider implements the EmailProvider interface for SendGrid
func NewSendGridProvider ¶
func NewSendGridProvider(apiKey, fromEmail string) *SendGridProvider
NewSendGridProvider creates a new SendGrid email provider
func (*SendGridProvider) SendEmail ¶
func (p *SendGridProvider) SendEmail(ctx context.Context, options SendOptions) error
SendEmail sends an email using SendGrid
type SendOptions ¶
type SendOptions struct {
From Recipient
To Recipient
Title string
Content string
HTMLContent string
}
SendOptions are options used to define the message sent.