relay

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package relay forwards messages through an upstream SMTP server.

Two entry points:

  • Probe — verify reachability + auth (used by the dialog's "Send test" button); doesn't actually send mail.
  • Forward — relay a stored RFC822 source through the upstream to one or more recipients, applying optional From / Return-Path overrides.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAddrs

func ParseAddrs(in []string) []*mail.Address

ParseAddrs is a small helper for callers that have a slice of recipient strings: returns the parsed mailboxes (drops malformed).

Types

type Client

type Client struct{}

func (*Client) Forward

func (c *Client) Forward(ctx context.Context, conn *store.RelayConnection,
	m *store.Message, recipients []string, rewriteTo bool,
) error

Forward relays a stored message to `recipients` at the SMTP envelope level (RCPT TO) — delivery always goes to `recipients` regardless of the message headers. The message body is preserved verbatim except:

  • conn.OverrideFrom (when set) rewrites the From: header, stashing the original under X-Original-From.
  • conn.ReturnPath (when set) rewrites the SMTP envelope sender.
  • rewriteTo (when true) rewrites the To: header to `recipients`, stashing the original under X-Original-To. Used by the manual "Release" action so the delivered copy reads as addressed to the person it was released to. Auto-relay passes false: it mirrors the message untouched, and rewriting To: to the envelope recipients would otherwise leak Bcc'd addresses into the visible To: header.

func (*Client) Probe

func (c *Client) Probe(ctx context.Context, host string, port int, username, password, authMode, tlsMode string) error

Probe opens a connection, runs STARTTLS / auth as configured, and closes cleanly. Returns nil on success. Used by `relay_connection/test`.

Jump to

Keyboard shortcuts

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