email

package
v0.0.0-...-17c065c Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailAddress

type EmailAddress struct {
	Email string `json:"email"`
	Name  string `json:"name,omitempty"`
}

type EmailRequest

type EmailRequest struct {
	From    EmailAddress   `json:"from"`
	To      []EmailAddress `json:"to"`
	Subject string         `json:"subject"`
	HTML    string         `json:"html"`
}

type EmailSender

type EmailSender interface {
	SendEmail(recipientEmail string, subject string, htmlContent string) error
}

EmailSender defines an interface for sending emails, allowing for different implementations.

type MailerSendClient

type MailerSendClient struct {
	APIKey      string
	BaseURL     string
	FromEmail   string
	FromName    string
	SubjectLine string
}

func NewMailerSendClient

func NewMailerSendClient(apiKey string) *MailerSendClient

func (*MailerSendClient) SendEmail

func (m *MailerSendClient) SendEmail(recipientEmail string, subject string, htmlContent string) error

SendEmail sends an email using the MailerSend API.

func (*MailerSendClient) SetSender

func (m *MailerSendClient) SetSender(email, name string)

SetSender sets the from email address and name

func (*MailerSendClient) SetSubject

func (m *MailerSendClient) SetSubject(subject string)

SetSubject sets the email subject line

type SMTPClient

type SMTPClient struct {
	Config SMTPConfig
}

SMTPClient is a client for sending emails via SMTP.

func NewSMTPClient

func NewSMTPClient(config SMTPConfig) *SMTPClient

NewSMTPClient creates a new SMTP client.

func (*SMTPClient) SendEmail

func (s *SMTPClient) SendEmail(recipientEmail string, subject string, htmlContent string) error

SendEmail sends an email using SMTP.

type SMTPConfig

type SMTPConfig struct {
	Host     string
	Port     string
	Username string
	Password string
	From     string // Sender email address
}

SMTPConfig holds configuration details for the SMTP server.

type Service

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

Service provides email sending functionality with template support

func NewService

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

NewService creates a new email service

func (*Service) GetAvailableTemplates

func (s *Service) GetAvailableTemplates() []string

GetAvailableTemplates returns a list of available template names

func (*Service) SendTemplatedEmail

func (s *Service) SendTemplatedEmail(recipientEmail, templateName string, data map[string]interface{}) error

SendTemplatedEmail sends an email using a template

Jump to

Keyboard shortcuts

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