mailer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mailer provides a simple SMTP mailer for generated projects. Copy this package into your project — it does not import drp at runtime. Built on net/smtp only; no third-party mail library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WelcomeHTML

func WelcomeHTML(name string) (string, error)

WelcomeHTML renders the HTML welcome email body for the given name.

func WelcomeText

func WelcomeText(name string) (string, error)

WelcomeText renders the plain-text welcome email body for the given name.

Types

type Mailer

type Mailer struct {
	Host     string
	Port     int
	Username string
	Password string
	From     string
}

Mailer sends transactional emails via SMTP.

func New

func New(host string, port int, username, password, from string) *Mailer

New constructs a Mailer. Port is typically 587 (STARTTLS) or 465 (TLS).

func (*Mailer) Send

func (m *Mailer) Send(to, subject, body string) error

Send sends a plain-text email to the given recipient.

func (*Mailer) SendHTML

func (m *Mailer) SendHTML(to, subject, htmlBody string) error

SendHTML sends an HTML email to the given recipient.

func (*Mailer) SendWelcome

func (m *Mailer) SendWelcome(to, name string) error

SendWelcome is a convenience method that sends the welcome email to a user.

Jump to

Keyboard shortcuts

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