Versions in this module Expand all Collapse all v0 v0.1.0 Aug 20, 2026 Changes in this version + const StatusClicked + const StatusDelivered + const StatusFailed + const StatusInvalid + const StatusOpened + const StatusPending + const StatusSent + const StatusSoftBounce + const StatusSpam + const StatusUnknown + const StatusUnsubscribed + func InitialMailStatus(kind string) string + func ParseSender(fromField, nameFallback string) (name, email string, err error) + func ReplacePlaceholders(template string, vars map[string]any) string + func ResolveMailLogStatusTransition(current, incoming string) (next string, apply bool) + func SendCloudEventToStatus(event string) string + func SendCloudStatusToMailStatus(status string) string + func VerifySendCloudInboundSignature(event *SendCloudInboundEvent, apiKey string) bool + type Channel struct + func NewChannel(name string, mailer *Mailer) *Channel + func (c *Channel) Enabled() bool + func (c *Channel) Name() string + func (c *Channel) Send(ctx context.Context, msg notification.Message) error + func (c *Channel) SetEnabled(enabled bool) + func (c *Channel) Type() notification.MessageType + type IMAPConfig struct + Host string + Mailbox string + Password string + Port int + Username string + type IMAPReader struct + func NewIMAPReader(cfg IMAPConfig) (*IMAPReader, error) + func (r *IMAPReader) Close() error + func (r *IMAPReader) DeleteMessage(id string) error + func (r *IMAPReader) MarkRead(id string) error + func (r *IMAPReader) ReadMessages(limit int) ([]*MailMessage, error) + func (r *IMAPReader) ReadRecentMessages(limit int) ([]*MailMessage, error) + type MailAttachment struct + ContentType string + Data []byte + Filename string + Size int64 + type MailLog struct + ChannelName string + CreatedAt time.Time + ErrorMsg string + HtmlBody string + ID string + MessageID string + Provider string + RetryCount int + SentAt time.Time + Status string + Subject string + ToEmail string + UpdatedAt time.Time + type MailLogStore interface + CreateFailedMailLog func(log *MailLog) error + CreateMailLog func(log *MailLog) error + GetMailLogByMessageID func(messageID string) (*MailLog, error) + GetMailLogStats func() (map[string]int64, error) + GetMailLogs func(page, pageSize int) ([]*MailLog, int64, error) + UpdateMailLogStatusByMessageID func(messageID, provider, status, errorMsg string) error + type MailMessage struct + Attachments []MailAttachment + Cc []string + Date time.Time + From string + FromName string + HTMLBody string + Headers mail.Header + ID string + ReplyTo string + Subject string + TextBody string + To []string + func ParseMailMessage(raw []byte) (*MailMessage, error) + type MailProvider interface + Kind func() string + SendHTMLWith func(to, subject, htmlBody string, vars map[string]any) (string, error) + SendTextWith func(to, subject, textBody string, vars map[string]any) (string, error) + type MailReader interface + Close func() error + DeleteMessage func(id string) error + MarkRead func(id string) error + ReadMessages func(limit int) ([]*MailMessage, error) + type Mailer struct + func NewMailer(providers []MailProvider, opts ...MailerOption) *Mailer + func (m *Mailer) Send(ctx context.Context, to, subject, htmlBody string) error + func (m *Mailer) SendText(ctx context.Context, to, subject, textBody string) error + func (m *Mailer) SendWithTemplate(ctx context.Context, to, subject, templateCode string, vars map[string]any, ...) error + type MailerOption func(*Mailer) + func WithRetryPolicy(p RetryPolicy) MailerOption + func WithStartingIndex(i int) MailerOption + type MemoryMailLogStore struct + func NewMemoryMailLogStore() *MemoryMailLogStore + func (s *MemoryMailLogStore) CreateFailedMailLog(log *MailLog) error + func (s *MemoryMailLogStore) CreateMailLog(log *MailLog) error + func (s *MemoryMailLogStore) GetMailLogByMessageID(messageID string) (*MailLog, error) + func (s *MemoryMailLogStore) GetMailLogStats() (map[string]int64, error) + func (s *MemoryMailLogStore) GetMailLogs(page, pageSize int) ([]*MailLog, int64, error) + func (s *MemoryMailLogStore) UpdateMailLogStatusByMessageID(messageID, provider, status, errorMsg string) error + type MemoryMailReader struct + func NewMemoryMailReader() *MemoryMailReader + func (r *MemoryMailReader) AddMessage(id string, raw []byte) + func (r *MemoryMailReader) Close() error + func (r *MemoryMailReader) DeleteMessage(id string) error + func (r *MemoryMailReader) MarkRead(id string) error + func (r *MemoryMailReader) ReadMessages(limit int) ([]*MailMessage, error) + type RetryPolicy struct + InitialBackoff time.Duration + MaxAttempts int + MaxBackoff time.Duration + func DefaultRetryPolicy() RetryPolicy + type SMTPConfig struct + From string + FromName string + Host string + Password string + Port int + Username string + type SMTPProvider struct + func NewSMTPProvider(cfg SMTPConfig) *SMTPProvider + func (p *SMTPProvider) Kind() string + func (p *SMTPProvider) SendHTMLWith(to, subject, htmlBody string, vars map[string]any) (string, error) + func (p *SMTPProvider) SendTextWith(to, subject, textBody string, vars map[string]any) (string, error) + type SendCloudConfig struct + APIKey string + APIUser string + Endpoint string + From string + FromName string + type SendCloudDeliveryRecord struct + APIUser string + EmailID string + ModifiedTime string + Recipients string + RequestTime string + SendLog string + Status string + SubStatus string + SubStatusDesc string + func (r SendCloudDeliveryRecord) ParsedModifiedTime() time.Time + func (r SendCloudDeliveryRecord) ParsedRequestTime() time.Time + type SendCloudInboundEvent struct + EmailID string + Event string + From string + FromName string + HTML string + Headers string + LabelID int + LabelName string + Message string + RawMessage string + RawMessageURL string + Reference string + Signature string + Subject string + Text string + Timestamp int64 + To string + ToName string + Token string + UserHeaders string + XMXMailFrom string + XMXRcptTo string + func ParseSendCloudInboundEvent(data []byte) (*SendCloudInboundEvent, error) + func (e *SendCloudInboundEvent) ToMailMessage() (*MailMessage, error) + type SendCloudProvider struct + func NewSendCloudProvider(cfg SendCloudConfig) (*SendCloudProvider, error) + func (p *SendCloudProvider) Kind() string + func (p *SendCloudProvider) SendHTMLWith(to, subject, htmlBody string, vars map[string]any) (string, error) + func (p *SendCloudProvider) SendTextWith(to, subject, textBody string, vars map[string]any) (string, error) + type SendCloudReader struct + func NewSendCloudReader(cfg SendCloudConfig) (*SendCloudReader, error) + func (r *SendCloudReader) AddInboundRoute(expression, action, apiUserRoute string) (int, error) + func (r *SendCloudReader) Close() error + func (r *SendCloudReader) DeleteInboundRoute(routeID int) error + func (r *SendCloudReader) DeleteMessage(id string) error + func (r *SendCloudReader) Kind() string + func (r *SendCloudReader) ListInboundRoutes(domain string, start, limit int) ([]SendCloudRoute, error) + func (r *SendCloudReader) MarkRead(id string) error + func (r *SendCloudReader) QueryStatus(q SendCloudStatusQuery) ([]SendCloudDeliveryRecord, int, error) + func (r *SendCloudReader) ReadMessages(limit int) ([]*MailMessage, error) + type SendCloudRoute struct + APIUserRoute string + Action string + Domain string + Expression string + ID int + type SendCloudStatusQuery struct + APIUserList []string + Days int + Email string + EmailIDs []string + EndDate string + LabelID string + LabelName string + Limit int + Start int + StartDate string + Status string + SubStatus string + type SendCloudWebhookEvent struct + Email string + Event string + MessageID string + SmtpError string + SmtpStatus string + Timestamp int64 + func ParseSendCloudWebhookEvent(data []byte) (*SendCloudWebhookEvent, error)