Help us shape the future of Go! Take the 2026 Go Developer Survey

email

package
v1.11.4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package email provides the email_send tool for sending emails via SMTP.

This tool is deliberately transport-agnostic: it speaks SMTP directly, which works with any provider (Gmail, SendGrid, Postmark, SES, Mailgun, self-hosted) without requiring provider-specific SDKs.

Implementation notes for contributors:

  • Use net/smtp from the standard library for the SMTP client — no deps needed.
  • For TLS: use smtp.DialTLS (port 465) or smtp.SendMail with STARTTLS (port 587).
  • For Gmail: enable "App Passwords" (2FA must be on) and use port 587.
  • For SendGrid/Mailgun: use their SMTP relay — same code, different credentials.
  • HTML bodies: set Content-Type: text/html; charset=UTF-8 in the MIME headers.
  • Multipart: for both HTML and plain-text, use multipart/alternative.
  • Attachments: multipart/mixed wrapping multipart/alternative + base64 parts.
  • Start with plain-text only, add HTML + attachments as follow-up.

Env vars:

SMTP_HOST      — SMTP server hostname (e.g. smtp.gmail.com)
SMTP_PORT      — port number (587 for STARTTLS, 465 for TLS)
SMTP_USER      — SMTP username / email address
SMTP_PASSWORD  — SMTP password or app password
SMTP_FROM      — default From address (optional, falls back to SMTP_USER)

See GitHub issue for full implementation spec.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("email_send: not implemented — see GitHub issue")

Functions

This section is empty.

Types

type SendTool

type SendTool struct{}

func NewSendTool

func NewSendTool() *SendTool

func (*SendTool) BackfillInput

func (t *SendTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*SendTool) Call

func (*SendTool) CheckPermissions

func (t *SendTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult

func (*SendTool) Definition

func (t *SendTool) Definition() tool.Definition

func (*SendTool) Description

func (t *SendTool) Description(_ context.Context) (string, error)

func (*SendTool) FormatResult

func (t *SendTool) FormatResult(data any) string

func (*SendTool) IsConcurrencySafe

func (t *SendTool) IsConcurrencySafe(_ map[string]any) bool

func (*SendTool) IsEnabled

func (t *SendTool) IsEnabled() bool

func (*SendTool) IsReadOnly

func (t *SendTool) IsReadOnly(_ map[string]any) bool

func (*SendTool) ValidateInput

func (t *SendTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

Jump to

Keyboard shortcuts

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