email

package
v0.0.0-...-9fac881 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LazyService

type LazyService struct {
	// contains filtered or unexported fields
}

func NewLazyService

func NewLazyService() *LazyService

func (*LazyService) IsConfigured

func (l *LazyService) IsConfigured() bool

func (*LazyService) Send

func (l *LazyService) Send(ctx context.Context, to, subject, body string) error

func (*LazyService) SendInvitationEmail

func (l *LazyService) SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error
func (l *LazyService) SendMagicLink(ctx context.Context, to, token, link string) error

func (*LazyService) SendPasswordReset

func (l *LazyService) SendPasswordReset(ctx context.Context, to, token, link string) error

func (*LazyService) SendVerificationEmail

func (l *LazyService) SendVerificationEmail(ctx context.Context, to, token, link string) error

func (*LazyService) SetResolver

func (l *LazyService) SetResolver(resolve func() Service)

type MailgunService

type MailgunService struct {
	// contains filtered or unexported fields
}

MailgunService handles email sending via Mailgun

func NewMailgunService

func NewMailgunService(cfg *config.EmailConfig) (*MailgunService, error)

NewMailgunService creates a new Mailgun email service

func (*MailgunService) IsConfigured

func (s *MailgunService) IsConfigured() bool

IsConfigured returns true if the Mailgun service is properly configured

func (*MailgunService) Send

func (s *MailgunService) Send(ctx context.Context, to, subject, body string) error

Send sends a generic email via Mailgun

func (*MailgunService) SendInvitationEmail

func (s *MailgunService) SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error

SendInvitationEmail sends an invitation email via Mailgun

func (s *MailgunService) SendMagicLink(ctx context.Context, to, token, link string) error

SendMagicLink sends a magic link email via Mailgun

func (*MailgunService) SendPasswordReset

func (s *MailgunService) SendPasswordReset(ctx context.Context, to, token, link string) error

SendPasswordReset sends a password reset email via Mailgun

func (*MailgunService) SendVerificationEmail

func (s *MailgunService) SendVerificationEmail(ctx context.Context, to, token, link string) error

SendVerificationEmail sends an email verification link via Mailgun

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(envConfig *config.EmailConfig, settingsCache *settings.SettingsCache, secretsService *settings.SecretsService, baseConfig *config.Config) *Manager

func (*Manager) GetService

func (m *Manager) GetService() Service

GetService returns the current email service

func (*Manager) GetServiceForConfig

func (m *Manager) GetServiceForConfig(cfg *config.EmailConfig) (Service, error)

GetServiceForConfig returns an email service for the given config. This is used for tenant-specific email configuration.

func (*Manager) RefreshFromSettings

func (m *Manager) RefreshFromSettings(ctx context.Context) error

func (*Manager) WrapAsService

func (m *Manager) WrapAsService() Service

WrapAsService creates a Service wrapper around the manager

type NoOpService

type NoOpService struct {
	// contains filtered or unexported fields
}

NoOpService is a no-op email service for when email is disabled or not configured

func NewNoOpService

func NewNoOpService(reason string) *NoOpService

NewNoOpService creates a new NoOpService with the given reason

func (*NoOpService) IsConfigured

func (s *NoOpService) IsConfigured() bool

func (*NoOpService) Send

func (s *NoOpService) Send(ctx context.Context, to, subject, body string) error

func (*NoOpService) SendInvitationEmail

func (s *NoOpService) SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error
func (s *NoOpService) SendMagicLink(ctx context.Context, to, token, link string) error

func (*NoOpService) SendPasswordReset

func (s *NoOpService) SendPasswordReset(ctx context.Context, to, token, link string) error

func (*NoOpService) SendVerificationEmail

func (s *NoOpService) SendVerificationEmail(ctx context.Context, to, token, link string) error

type SESService

type SESService struct {
	// contains filtered or unexported fields
}

SESService handles email sending via AWS SES

func NewSESService

func NewSESService(cfg *config.EmailConfig) (*SESService, error)

NewSESService creates a new AWS SES email service

func (*SESService) IsConfigured

func (s *SESService) IsConfigured() bool

IsConfigured returns true if the SES service is properly configured

func (*SESService) Send

func (s *SESService) Send(ctx context.Context, to, subject, body string) error

Send sends a generic email via AWS SES

func (*SESService) SendInvitationEmail

func (s *SESService) SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error

SendInvitationEmail sends an invitation email via AWS SES

func (s *SESService) SendMagicLink(ctx context.Context, to, token, link string) error

SendMagicLink sends a magic link email via AWS SES

func (*SESService) SendPasswordReset

func (s *SESService) SendPasswordReset(ctx context.Context, to, token, link string) error

SendPasswordReset sends a password reset email via AWS SES

func (*SESService) SendVerificationEmail

func (s *SESService) SendVerificationEmail(ctx context.Context, to, token, link string) error

SendVerificationEmail sends an email verification link via AWS SES

type SMTPService

type SMTPService struct {
	// contains filtered or unexported fields
}

SMTPService handles email sending via SMTP

func NewSMTPService

func NewSMTPService(cfg *config.EmailConfig) *SMTPService

NewSMTPService creates a new SMTP email service

func (*SMTPService) IsConfigured

func (s *SMTPService) IsConfigured() bool

IsConfigured returns true if the SMTP service is properly configured

func (*SMTPService) Send

func (s *SMTPService) Send(ctx context.Context, to, subject, body string) error

Send sends an email via SMTP

func (*SMTPService) SendInvitationEmail

func (s *SMTPService) SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error

SendInvitationEmail sends an invitation email

func (s *SMTPService) SendMagicLink(ctx context.Context, to, token, link string) error

SendMagicLink sends a magic link email

func (*SMTPService) SendPasswordReset

func (s *SMTPService) SendPasswordReset(ctx context.Context, to, token, link string) error

SendPasswordReset sends a password reset email

func (*SMTPService) SendVerificationEmail

func (s *SMTPService) SendVerificationEmail(ctx context.Context, to, token, link string) error

SendVerificationEmail sends an email verification link

type SendGridService

type SendGridService struct {
	// contains filtered or unexported fields
}

SendGridService handles email sending via SendGrid

func NewSendGridService

func NewSendGridService(cfg *config.EmailConfig) (*SendGridService, error)

NewSendGridService creates a new SendGrid email service

func (*SendGridService) IsConfigured

func (s *SendGridService) IsConfigured() bool

IsConfigured returns true if the SendGrid service is properly configured

func (*SendGridService) Send

func (s *SendGridService) Send(ctx context.Context, to, subject, body string) error

Send sends a generic email via SendGrid

func (*SendGridService) SendInvitationEmail

func (s *SendGridService) SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error

SendInvitationEmail sends an invitation email via SendGrid

func (s *SendGridService) SendMagicLink(ctx context.Context, to, token, link string) error

SendMagicLink sends a magic link email via SendGrid

func (*SendGridService) SendPasswordReset

func (s *SendGridService) SendPasswordReset(ctx context.Context, to, token, link string) error

SendPasswordReset sends a password reset email via SendGrid

func (*SendGridService) SendVerificationEmail

func (s *SendGridService) SendVerificationEmail(ctx context.Context, to, token, link string) error

SendVerificationEmail sends an email verification link via SendGrid

type Service

type Service interface {
	// SendMagicLink sends a magic link email
	SendMagicLink(ctx context.Context, to, token, link string) error

	// SendVerificationEmail sends an email verification link
	SendVerificationEmail(ctx context.Context, to, token, link string) error

	// SendPasswordReset sends a password reset email
	SendPasswordReset(ctx context.Context, to, token, link string) error

	// SendInvitationEmail sends an invitation email
	SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error

	// Send sends a generic email
	Send(ctx context.Context, to, subject, body string) error

	// IsConfigured returns true if the email service is properly configured and can send emails
	IsConfigured() bool
}

Service defines the interface for email providers

func NewService

func NewService(cfg *config.EmailConfig) (Service, error)

NewService creates an email service based on configuration

type ServiceWrapper

type ServiceWrapper struct {
	// contains filtered or unexported fields
}

ServiceWrapper wraps the manager to implement the Service interface This allows the manager to be used wherever a Service is expected

func (*ServiceWrapper) IsConfigured

func (w *ServiceWrapper) IsConfigured() bool

IsConfigured implements Service

func (*ServiceWrapper) Send

func (w *ServiceWrapper) Send(ctx context.Context, to, subject, body string) error

Send implements Service

func (*ServiceWrapper) SendInvitationEmail

func (w *ServiceWrapper) SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error

SendInvitationEmail implements Service

func (w *ServiceWrapper) SendMagicLink(ctx context.Context, to, token, link string) error

SendMagicLink implements Service

func (*ServiceWrapper) SendPasswordReset

func (w *ServiceWrapper) SendPasswordReset(ctx context.Context, to, token, link string) error

SendPasswordReset implements Service

func (*ServiceWrapper) SendVerificationEmail

func (w *ServiceWrapper) SendVerificationEmail(ctx context.Context, to, token, link string) error

SendVerificationEmail implements Service

type TestEmailService

type TestEmailService struct{}

TestEmailService is a no-op email service for testing that succeeds for all operations

func NewTestEmailService

func NewTestEmailService() *TestEmailService

NewTestEmailService creates a new TestEmailService for testing

func (*TestEmailService) IsConfigured

func (s *TestEmailService) IsConfigured() bool

func (*TestEmailService) Send

func (s *TestEmailService) Send(ctx context.Context, to, subject, body string) error

func (*TestEmailService) SendInvitationEmail

func (s *TestEmailService) SendInvitationEmail(ctx context.Context, to, inviterName, inviteLink string) error
func (s *TestEmailService) SendMagicLink(ctx context.Context, to, token, link string) error

func (*TestEmailService) SendPasswordReset

func (s *TestEmailService) SendPasswordReset(ctx context.Context, to, token, link string) error

func (*TestEmailService) SendVerificationEmail

func (s *TestEmailService) SendVerificationEmail(ctx context.Context, to, token, link string) error

Jump to

Keyboard shortcuts

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