smtn

| #smtn #smtp-pushover #go #linux

One of the unsung heroes of my personal Linux server setups is a simple Node.js application I wrote called smtp-pushover. It’s an SMTP (email sending) server that forwards any email it receives to Pushover.

I recently rewrote it in Go and published the new version as smtn. It supports other notification services now!

What do I use this for?

I primarily use this for getting smartd, ZED, apcupsd, etc. messages to my phone in a format I’ll actually see.

It also works for quickly sending notifications from the command line since Linux distros tend to include some sort of tool for sending email via SMTP. I have a script called notify that’s basically just this:

#!/bin/bash

# Usage: `notify "title" "body"`
echo -e "Subject:$1\n\n$2" | msmtp --from notify@localhost --host localhost whatever@localhost

Why did I rewrite it?

Mostly because I’ve been writing in Go lately and I felt like I’ve learned enough since smtp-pushover to do a better job with it. Go also feels like a better fit for this sort of tool.

But I also made a few improvements…

New features

Other thoughts

I really like urfave/cli

smtn uses urfave/cli and I’ve really enjoyed it. It made it easy to make matching command line arguments and environment variable options.

Naming is hard

When I first started working on this, I called it “smtprrr” like the combination of SMTP and the shoutrrr module that it uses for notifications. But that never really sat well with me.

I ended up naming it “smtn”. It’s kind of an acronym for “Simple Mail to Notification” and I pronounce it like “smitten”. I also wanted to keep it short and one word to resemble Go’s module naming conventions.

A SMTP server? An SMTP server?

Which one of these is correct?

Should the a/an match the expanded “Simple Mail Transfer Protocol” or should it match how you’d pronounce the letters in “SMTP”?.

TIL the difference between an acronym and an initialism:

For initialisms, the a is supposed to match the pronuncation of the first letter. So “an SMTP server” is the correct answer here.

With smtp-pushover, I sneakily avoided confusion by describing it as

A simple SMTP server that forwards emails to Pushover

smtn confidently uses the wrong correct article since v0.1.2:

smtn is an SMTP server that forwards messages to one or more notification services