What is Swaks? Swaks (Swiss Army Knife for SMTP) is a versatile, scriptable tool for testing SMTP servers and sending emails from the command line. It supports TLS encryption, various authentication methods, and is designed as a diagnostic tool rather than for high-volume sending.
Prerequisites
Before sending, verify your domain and create an SMTP credential. Use a sandbox credential for these examples so no email is delivered. Keep the username and password in your server’s secret store. Before you begin, ensure you have:System Requirements
System Requirements
- Swaks installed on your system
- Command line access (Terminal, Command Prompt, etc.)
- Basic familiarity with command-line tools
Installation
Install Swaks using your system’s package manager:Connection Settings
All message data is stored in the EU. See SMTP limits.
Basic Email Examples
Advanced Examples
Using Special Headers
Add AhaSend’s special headers to control tracking, retention, and other features:Testing with Sandbox Mode
Use sandbox mode to safely test your email integration:Sandbox Benefits: Emails sent in sandbox mode are free, trigger webhooks normally, and never actually deliver to recipients - perfect for development and testing.
Scripting and Automation
Shell Script Example
Email Script Example
Environment Variables
For security, use environment variables for credentials:Environment Setup
Resources
Swaks Documentation
Official Swaks documentation and manual
SMTP Testing Guide
Complete guide to testing email delivery
AhaSend SMTP Settings
SMTP server configuration and credentials
AhaSend Support
Get help from our engineering team
Related Guides
- Before sending: verify your domain and create an SMTP credential.
- Connection and message rules: SMTP hosts, ports and limits, special headers, sandbox mode, retention and plan features.
- Other ways to send: REST API, AhaSend CLI, Node.js SDK and Go SDK.
- Delivery events: webhook setup and local webhook testing.

