Skip to content
Worix
BrowsePublish
Log inSign Up

Simple SMTP Mailer

Send emails via SMTP using the msmtp command-line tool configured in ~/.msmtp/config for authentication and server settings.

69 downloads
Free
Reviewed

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) or 587 (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 --file flag
  • "Authentication failed": Verify username and password (or App Password)
  • "Connection refused": Check port number and firewall settings
  • "TLS certificate error": Try tls_certcheck off in config (not recommended for production)

Download

ZIP package — ready to use

Skill Info

Creator
HITYGX
Downloads
69
Published
Mar 15, 2026
Updated
Mar 16, 2026