mailer

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderEmail

func RenderEmail(ctx context.Context, component templ.Component) (html string, text string, err error)

RenderEmail renders a templ component into HTML plus a plain-text fallback.

Types

type LayoutComponent

type LayoutComponent func(content templ.Component) templ.Component

type LogMailClient

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

func NewLogMailClient

func NewLogMailClient(logger *slog.Logger) *LogMailClient

func (*LogMailClient) Send

func (c *LogMailClient) Send(_ context.Context, email *mail) error

type MailClient

type MailClient struct {

	// MailSender provides the actual implementation to send emails
	MailSender MailClientInterface
	// contains filtered or unexported fields
}

MailClient provides a client for sending email This is purposely not completed because there are many different methods and services for sending email, many of which are very different. Choose what works best for you and populate the methods below

func NewMailClient

func NewMailClient(cfg *config.Config, sender MailClientInterface) (*MailClient, error)

NewMailClient creates a new MailClient

func (*MailClient) Compose

func (m *MailClient) Compose() *mail

Compose creates a new email

type MailClientInterface

type MailClientInterface interface {
	Send(ctx context.Context, email *mail) error
}

type ResendMailClient

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

func NewResendMailClient

func NewResendMailClient(apiKey string) *ResendMailClient

func NewResendMailClientWithSender

func NewResendMailClientWithSender(sender resendSender) *ResendMailClient

func (*ResendMailClient) Send

func (r *ResendMailClient) Send(ctx context.Context, email *mail) error

type SMTPMailClient

type SMTPMailClient struct {
	Port     int
	Host     string
	Username string
	Password string
}

func NewSMTPMailClient

func NewSMTPMailClient(host string, port int) *SMTPMailClient

func NewSMTPMailClientWithAuth

func NewSMTPMailClientWithAuth(host string, port int, user, pass string) *SMTPMailClient

func (*SMTPMailClient) Send

func (c *SMTPMailClient) Send(_ context.Context, email *mail) error

Send sends an email using SMTP

Jump to

Keyboard shortcuts

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