smtp

package
v0.0.0-...-51f860f Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package smtp is a Sender backed by any SMTP server (net/smtp).

This is the portable backend: every provider speaks SMTP, and a local catch-all (MailHog, Mailpit) speaks it too. For a free transactional path that accepts a personal sender without a verified domain, see the brevo backend instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sender

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

Sender delivers messages through one SMTP server. Safe for concurrent use: net/smtp opens a fresh connection per Send.

func New

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

New returns a Sender for the SMTP server at host:port. username/password are used for PLAIN auth (the near-universal choice for submission on 587). Pass empty credentials for an unauthenticated relay (e.g. a local catcher).

func (*Sender) Send

func (s *Sender) Send(ctx context.Context, m mailer.Message) error

Send validates m, builds an RFC 5322 message, and delivers it. net/smtp's SendMail upgrades to STARTTLS automatically when the server advertises it.

Jump to

Keyboard shortcuts

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