AgentSMTP CLI
Use agentsmtp when a workflow needs a thin SMTP client instead of a full mail app. The tool resolves provider defaults, loads config from file or environment, and keeps output machine-readable.
Invoke the Tool
Prefer the installed binary when it exists:
agentsmtp profile -provider gmail -from student@gmail.com
If working inside this repository or the binary is not installed, run:
go run ./cmd/agentsmtp -- profile -provider gmail -from student@gmail.com
Choose Commands
- Use
profileto inspect the resolved SMTP host, port, auth mode, and whether a secret source is configured. - Use
testto open an SMTP session, authenticate, and runNOOPwithout sending mail. - Use
sendto submit a plain-text message with repeated-to,-cc, and-bccflags.
Apply Good Defaults
- Prefer
-provider gmailor-provider google-workspacefor Google-hosted mail because the tool fillssmtp.gmail.com:587andSTARTTLS. - Keep secrets in
-password-envor-password-filerather than inline flags when possible. - Pipe message text over stdin for agent workflows instead of shell-escaping large bodies.
- Use
-format jsonfor downstream parsing and-format textfor quick debugging.
Examples
Inspect a Google Workspace profile:
go run ./cmd/agentsmtp -- profile -provider google-workspace -from student@example.edu -password-env SMTP_PASSWORD -format text
Test Gmail SMTP with an app password:
go run ./cmd/agentsmtp -- test -provider gmail -from student@gmail.com -password-env GMAIL_APP_PASSWORD -format text
Send a plain-text message from stdin:
printf 'Hello from agentsmtp\n' | go run ./cmd/agentsmtp -- send -provider google-workspace -from student@example.edu -password-env SMTP_PASSWORD -to advisor@example.edu -subject "Status"