No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-10 08:03:05 +00:00
.gitignore first commit 2026-11-10 08:03:05 +00:00
go.mod first commit 2026-11-10 08:03:05 +00:00
go.sum first commit 2026-11-10 08:03:05 +00:00
main.go first commit 2026-11-10 08:03:05 +00:00
README.md first commit 2026-11-10 08:03:05 +00:00
store.go first commit 2026-11-10 08:03:05 +00:00
tui.go first commit 2026-11-10 08:03:05 +00:00

mail-test

mail-test sends a test email through an SMTP server and reports whether the server accepted it. It has a terminal UI for keeping a list of mail servers and sending tests through them, and a line-based mode for one-off checks.

Requirements

  • Go 1.25 or newer (required by the golang.org/x/term dependency in go.mod)

Build

go build -o mail-test .

Run

Terminal UI (default):

./mail-test

Line-based prompts:

./mail-test -cli

The CLI asks for the server, port, security mode, optional credentials, and the message, shows a summary, and then sends. It does not save anything.

Terminal UI

The screen has three areas:

  • Mail servers (left): the saved servers. The highlighted server is the one the test is sent through.
  • Test message (right): From, To, Subject, Body, and Server password. The title shows which server is selected.
  • Log (bottom): results and errors.

Buttons under the server list:

  • Add server opens a form for name, host, port, security, and username.
  • Delete removes the highlighted server.
  • Quit exits. Ctrl+C also works.

Keys:

Key Action
Tab From the server list, move to the message form
F2 Move focus to the server list
F3 Move focus to the server buttons

Inside forms, Tab moves between fields as usual.

Sending a test

  1. Add a server, or highlight an existing one.
  2. Fill in From and To. Subject and Body have defaults.
  3. If the server has a username, type its password in Server password.
  4. Press Send test.

The password is needed only for that send. If the server has a username and the password field is empty, the send is refused and the log says which server needs a password.

Security modes

Each server uses one of these connection modes:

Mode Meaning
starttls Plain connection upgraded with STARTTLS (usually port 587). Default.
tls TLS from the first byte (usually port 465).
none No encryption. Cannot be combined with a username.

With starttls, the send fails if the server does not offer STARTTLS. With tls or starttls, TLS 1.2 or newer is required. Credentials are sent only over starttls or tls.

Saved servers

Servers are stored in servers.csv in the directory you run the program from. The file is created when you add or delete a server.

name,host,port,security,username
local,127.0.0.1,2525,starttls,user1
  • Passwords are never written to this file. You type them into the form each time you send.
  • The file is written with permissions 0600. It still contains hosts and usernames, so keep it out of version control. It is listed in .gitignore.

Limitations

  • A "Accepted" result means the SMTP server accepted the message for delivery. It does not confirm that the message reached the inbox.
  • Saved servers cannot be edited in the UI. To change one, delete it and add it again, or edit servers.csv and restart the program (the file is read only at startup).
  • Certificates are verified against the system trust store, using the host name you entered. Self-signed servers will fail.

Project layout

File Purpose
main.go Entry point, the -cli prompts, and the SMTP client
tui.go Terminal UI (tview) and validation
store.go Reading and writing servers.csv
go.mod Module and dependencies

Dependencies: tview for the UI, golang.org/x/term for hidden password input in -cli mode.