skip to content
Burak Berk Keskin
Table of Contents

Overview

When setting up self-hosted services, homelab servers, or CI/CD pipelines, configuring reliable email notifications is a routine requirement. However, debugging authentication failures, TLS port mismatches, or mail server rejections from inside deep application configuration panels is often painful.

gomtp is a lightweight, open-source CLI utility written in Go that validates SMTP credentials, TLS negotiation, and delivery directly from the command line (often paired with private TLS setups generated via crtforge). You can inspect the source code on the GitHub repository.

Table of Contents

  1. Install the gomtp tool
  2. Configure the SMTP settings
  3. Test the configuration
  4. Common Homelab Use Cases

Install gomtp

To install gomtp on Linux or macOS, download the latest binary directly:

Terminal window
sudo curl -L -o /usr/local/bin/gomtp "https://github.com/safderun/gomtp/releases/latest/download/gomtp-$(uname -s)-$(uname -m)" && \
sudo chmod +x /usr/local/bin/gomtp

SMTP Configuration

gomtp reads connection settings from a local configuration file.

  • Create a file named gomtp.yaml in your working directory:
Terminal window
vim gomtp.yaml

The configuration file must be named gomtp.yaml by default.

  • Populate the parameters for your SMTP provider:
##### Gmail App Password Example #####
username: 'from@gmail.com'
password: 'your-16-char-app-password'
from: 'from@gmail.com'
to: 'to@example.com'
host: 'smtp.gmail.com'
port: 587
ssl: false
tls: true
auth: 'LOGIN'
subject: 'SMTP Test Verification'
body: |
SMTP configuration test successful.
Host verified: smtp.gmail.com:587

Additional reference configurations for custom relays and ports are available in the example repository.

Test the Configuration

Run gomtp in the same directory where gomtp.yaml resides:

Terminal window
gomtp
  • Success Output: When credentials and network routing are correct, the binary exits cleanly:
Terminal window
$ gomtp
Email sent successfully!
  • Error Output: If the handshake fails, gomtp surfaces the exact upstream SMTP status code:
Terminal window
$ gomtp
2023/12/21 11:44:33 535 5.7.8 Error: authentication failed: Invalid user or password! 1703148273-WiJ7lX77XKo0

Common Homelab Use Cases

Testing with a standalone CLI binary first prevents unnecessary debugging cycles when configuring:

  • Proxmox VE & Backup Server: Ensuring node notifications reach sysadmin inboxes before storage drives or backups report errors.
  • Home Assistant: Validating Google or Fastmail app passwords before setting up automation notification blueprints.
  • Self-Hosted Monitoring & Reverse Proxies: Verifying outbound mail relay ports (587 STARTTLS / 465 SSL) are not blocked by ISP or upstream firewall rules.