Documentation
¶
Index ¶
- type EmailConfig
- type EmailRequest
- type EmailService
- func (e *EmailService) Close()
- func (e *EmailService) GetQueueLength() int
- func (e *EmailService) SendBulkEmail(emails []string, subject, htmlContent string) error
- func (e *EmailService) SendOTPEmail(email, firstName, otp string) error
- func (e *EmailService) SendPasswordResetEmail(email, resetLink string) error
- func (e *EmailService) SendWelcomeEmail(email, firstName string) error
- func (e *EmailService) TestEmailConnection() error
- type EmailServiceInterface
- type LocalEmailService
- func (l *LocalEmailService) Close() error
- func (l *LocalEmailService) GetQueueLength() int
- func (l *LocalEmailService) SendBulkEmail(emails []string, subject, htmlContent string) error
- func (l *LocalEmailService) SendOTPEmail(email, firstName, otp string) error
- func (l *LocalEmailService) SendPasswordResetEmail(email, resetLink string) error
- func (l *LocalEmailService) SendWelcomeEmail(email, firstName string) error
- func (l *LocalEmailService) TestEmailConnection() error
- type OTPEmailData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailConfig ¶
type EmailService ¶
type EmailService struct {
// contains filtered or unexported fields
}
func NewEmailService ¶
func NewEmailService(config EmailConfig) *EmailService
func (*EmailService) Close ¶
func (e *EmailService) Close()
Close gracefully shuts down the email service
func (*EmailService) GetQueueLength ¶
func (e *EmailService) GetQueueLength() int
GetQueueLength returns the current number of emails in the queue
func (*EmailService) SendBulkEmail ¶
func (e *EmailService) SendBulkEmail(emails []string, subject, htmlContent string) error
SendBulkEmail sends email to multiple recipients asynchronously (for announcements)
func (*EmailService) SendOTPEmail ¶
func (e *EmailService) SendOTPEmail(email, firstName, otp string) error
SendOTPEmail sends OTP verification email asynchronously (Django's send_register_otp equivalent)
func (*EmailService) SendPasswordResetEmail ¶
func (e *EmailService) SendPasswordResetEmail(email, resetLink string) error
SendPasswordResetEmail sends password reset email asynchronously
func (*EmailService) SendWelcomeEmail ¶
func (e *EmailService) SendWelcomeEmail(email, firstName string) error
SendWelcomeEmail sends welcome email after verification asynchronously
func (*EmailService) TestEmailConnection ¶
func (e *EmailService) TestEmailConnection() error
TestEmailConnection tests the email service configuration
type EmailServiceInterface ¶
type EmailServiceInterface interface { SendOTPEmail(email, firstName, otp string) error SendWelcomeEmail(email, firstName string) error SendPasswordResetEmail(email, resetLink string) error SendBulkEmail(emails []string, subject, htmlContent string) error TestEmailConnection() error GetQueueLength() int }
EmailServiceInterface defines the interface for email operations
func NewEmailServiceFactory ¶
func NewEmailServiceFactory(config EmailConfig, useLocal bool, logFilePath string) (EmailServiceInterface, error)
NewEmailServiceFactory creates email service based on environment configuration
type LocalEmailService ¶
type LocalEmailService struct {
// contains filtered or unexported fields
}
LocalEmailService implements EmailServiceInterface for local development Instead of sending emails, it logs them to a file for testing purposes
func NewLocalEmailService ¶
func NewLocalEmailService(logFilePath string) (*LocalEmailService, error)
NewLocalEmailService creates a new local email service that logs to file
func (*LocalEmailService) Close ¶
func (l *LocalEmailService) Close() error
Close closes the log file
func (*LocalEmailService) GetQueueLength ¶
func (l *LocalEmailService) GetQueueLength() int
GetQueueLength returns 0 for local service (no actual queue)
func (*LocalEmailService) SendBulkEmail ¶
func (l *LocalEmailService) SendBulkEmail(emails []string, subject, htmlContent string) error
SendBulkEmail logs bulk email details
func (*LocalEmailService) SendOTPEmail ¶
func (l *LocalEmailService) SendOTPEmail(email, firstName, otp string) error
SendOTPEmail logs OTP email details instead of sending
func (*LocalEmailService) SendPasswordResetEmail ¶
func (l *LocalEmailService) SendPasswordResetEmail(email, resetLink string) error
SendPasswordResetEmail logs password reset email details
func (*LocalEmailService) SendWelcomeEmail ¶
func (l *LocalEmailService) SendWelcomeEmail(email, firstName string) error
SendWelcomeEmail logs welcome email details
func (*LocalEmailService) TestEmailConnection ¶
func (l *LocalEmailService) TestEmailConnection() error
TestEmailConnection always returns success for local service