Documentation
¶
Index ¶
Constants ¶
View Source
const ( StyleHeading = "margin:0px;padding:10px 0px;text-align:left;font-size:22px;" StyleParagraph = "margin:0px;padding:10px 0px;text-align:left;font-size:16px;" StyleButton = "" /* 163-byte string literal not displayed */ )
Common style constants for email templates
Variables ¶
This section is empty.
Functions ¶
func DefaultTemplate ¶
func DefaultTemplate(options TemplateOptions) string
DefaultTemplate generates a standard responsive email template
Types ¶
type Config ¶
type Config struct {
// Host is the SMTP server host
Host string
// Port is the SMTP server port
Port string
// Username is the SMTP server username
Username string
// Password is the SMTP server password
Password string
// Logger for logging errors
Logger *slog.Logger
}
Config holds the email configuration
type SMTPSender ¶
type SMTPSender struct {
// contains filtered or unexported fields
}
SMTPSender implements the Sender interface using SMTP
func (*SMTPSender) Send ¶
func (s *SMTPSender) Send(options SendOptions) error
Send sends an email using SMTP
type SendOptions ¶
type SendOptions struct {
// From is the email sender
From string
// FromName is the name of the sender (unused for now)
FromName string
// To is the list of recipients
To []string
// Bcc is the list of BCC recipients
Bcc []string
// Cc is the list of CC recipients
Cc []string
// Subject is the email subject
Subject string
// HtmlBody is the HTML content of the email
HtmlBody string
// TextBody is the plain text content of the email
TextBody string
}
SendOptions defines the options for sending an email
type Sender ¶
type Sender interface {
// Send sends an email with the given options
Send(options SendOptions) error
}
Sender defines the interface for sending emails
func NewSMTPSender ¶
NewSMTPSender creates a new SMTP email sender
type TemplateOptions ¶
type TemplateOptions struct {
// Title is the email title
Title string
// Content is the HTML content to include in the template
Content string
// AppName is the application name to display in the header and footer
AppName string
// HeaderBackgroundColor is the background color for the header
HeaderBackgroundColor string
// Year is the copyright year (defaults to current year if empty)
Year string
// HeaderLinks is a map of link text to URLs for the header
HeaderLinks map[string]string
}
TemplateOptions defines the options for generating an email template
Click to show internal directories.
Click to hide internal directories.