snmail,v0.3.8(8)

πŸ’Œ snmail β€” mail-to-news filter

okay bestie, welcome to the snmail,v0.3.8(8) page from the System Manager's Manual section 8 (that's the admin-y section, iykyk). This is the glow-up of the classic manual, same facts, way more fun. Let's get into it πŸ’…


✨ NAME ✨

snmail β€” mail-to-news filter πŸ¦‹


🌸 SYNOPSIS 🌸

snmail [-sP] [listname [prefix]]

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: snmail reads one single email message on standard input, and writes the converted message to standard output. That output? It's literally made to be fed straight into snstore. Chef's kiss. πŸ‘‘

Here's everything snmail does to your message, no cap:

  • If the first line is a UUCP From_ line, it gets silently discarded. gone. bye. πŸ™ˆ
  • A Newsgroups: line is added with the value of prefixlistname (that's prefix concatenated with listname), and any other Newsgroups: lines that already exist get removed.
  • A Path: line is created from all the Received: lines, and then those Received: lines are removed.
  • All header lines are unfolded.
  • If there's no message ID, one gets created.
  • The message IDs sitting in all References: lines and In-Reply-To: lines are collected into a single References: line.
  • All lines are rewritten to end in CRLF.
  • And a lone . on a line gets written at the end of the message.

Also, snmail will accept and pass on messages with invalid header fields. It's very forgiving like that. 🫢

snmail is meant to be run from a .forward file, or from /etc/aliases (if you're running sendmail or something similar), or from a .qmail file (if qmail is your thing). And heads up β€” snmail may write status or error messages to standard error.


✨ OPTIONS ✨

  • -s β€” pipe output straight to snstore, don't write to standard output. This exists so the exit status doesn't get lost in a shell pipeline (we love not losing exit statuses πŸ’€). If you use this flag, it's also a really good idea to also use -c, which tells snstore to check if the article already exists.

🌈 Other options 🌈

snmail also accepts options meant for snstore, namely -c, -v, and -n, and these get passed on uninterpreted. Zero meddling. πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • prefix β€” this is the prefix of the newsgroup. If you don't specify it, it defaults to local. (note the trailing .). Also: prefix may not begin with a . (dot), but it may be empty.
  • listname β€” this completes the newsgroup name. If you don't specify it, it's the local part of the address in the Return-Path: line, as long as that exists and isn't empty. Otherwise? It's the local part of the message's first From:. So like, if the message came from the list <linux-lemmings@vger.rutgers.edu>, then the default newsgroup becomes local.linux-lemmings. And listname may be empty if prefix isn't.
bestie, you might wanna have a file /var/spool/sn/prefixlistname/.nopost so you can deny posting from all and sundry β€” that stops the mailing list newsgroup from getting contaminated. 🧼

Also, prefix and listname may contain uppercase characters β€” those get converted to lowercase. no shouting in newsgroup names πŸ’…


πŸ’œ USAGE πŸ’œ

There are two ways of forwarding mail to the sn news spool:

  1. Directly from a user's mail address. βœ‰οΈ
  2. Forwarded to a central address, and then invoking snmail. πŸ“¬

The big concern here is permissions β€” because while anyone can run snmail, not everyone may store mail in the spool. Mail setups vary a lot, so basically... you're on your own here. 😭


πŸ¦‹ ENVIRONMENT VARIABLES πŸ¦‹

  • SNROOT β€” if this is set and is not empty, its value is used in place of /var/spool/sn, the default news spool directory.
  • PATH β€” if -s was specified, this determines where to look for snstore, before looking in /usr/sbin.

⭐ EXIT STATUS ⭐

snmail exits 0 if the message was successfully converted and written β€” or if the message ID already exists in the ID database and the message was not stored or converted.

snmail exits with:

  • 1 on usage error
  • 2 on operational error
  • 3 if the mail message wasn't in the proper format

🌟 N.B. 🌟


and that's the whole page, bestie!! 🫢 this gem is by Harold Tay, and it's snmail,v0.3.8(8) β€” version 0.3.8, section 8 of the System Manager's Manual. no date on this one, iconic honestly. go forth and filter that mail-to-news, you absolute main character πŸ‘‘βœ¨

πŸ“¦ where this page comes from