Simple SMTP Mailer
Send emails via SMTP using the msmtp command-line tool configured in ~/.msmtp/config for authentication and server settings.
Latest: v1.0.0
- Initial release of simple-smtp-mail skill.
- Send emails via SMTP using the msmtp command-line tool.
- Provides documentation for configuring SMTP accounts for common mail providers (Gmail, QQ, Outlook, 163.com).
- Includes installation steps for msmtp on macOS and Linux.
- Offers example commands for sending emails with subject, from header, and HTML content.
- Lists basic troubleshooting tips for common configuration and connection issues.
Simple SMTP Mail
Send emails via SMTP using msmtp command-line tool.
Configuration
Create a configuration file at ~/.msmtp/config with the following format:
account default
host <SMTP_SERVER>
port <PORT>
tls on
tls_starttls off
auth on
user <EMAIL_ADDRESS>
password <PASSWORD>
from <EMAIL_ADDRESS>
Common SMTP Settings
Gmail:
- SMTP Server:
smtp.gmail.com - Port:
465(SSL) or587(TLS) - Note: Use App Password, not your regular password
QQ Mail:
- SMTP Server:
smtp.qq.com - Port:
465
Outlook/Hotmail:
- SMTP Server:
smtp.office365.com - Port:
587
163.com:
- SMTP Server:
smtp.163.com - Port:
465
Installation
1. Install msmtp
macOS:
brew install msmtp
Linux (Debian/Ubuntu):
sudo apt install msmtp
Linux (Fedora/RHEL):
sudo dnf install msmtp
2. Configure SMTP
Edit ~/.msmtp/config:
nano ~/.msmtp/config
3. Set Permissions
chmod 600 ~/.msmtp/config
Sending Email
Basic Email
echo "Body text" | msmtp recipient@example.com
With Subject
echo -e "Subject: Your Subject\n\nBody text" | msmtp recipient@example.com
With Subject and From Header
echo -e "Subject: Your Subject\nFrom: your@email.com\n\nBody text" | msmtp recipient@example.com
HTML Content
echo -e "Subject: Your Subject\nContent-Type: text/html; charset=UTF-8\n\n<html>...</html>" | msmtp recipient@example.com
Testing
Check if SMTP server is reachable:
msmtp --file=~/.msmtp/config --serverinfo
Troubleshooting
- "Account not found": Check your config file path with
--fileflag - "Authentication failed": Verify username and password (or App Password)
- "Connection refused": Check port number and firewall settings
- "TLS certificate error": Try
tls_certcheck offin config (not recommended for production)
