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 ¶
- Variables
- type SendTool
- func (t *SendTool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *SendTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *SendTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *SendTool) Definition() tool.Definition
- func (t *SendTool) Description(_ context.Context) (string, error)
- func (t *SendTool) FormatResult(data any) string
- func (t *SendTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *SendTool) IsEnabled() bool
- func (t *SendTool) IsReadOnly(_ map[string]any) bool
- func (t *SendTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
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 (*SendTool) Call ¶
func (t *SendTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
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) FormatResult ¶
Click to show internal directories.
Click to hide internal directories.