nullmailer-inject(1)

πŸ’Œ nullmailer-inject β€” the inject-y one (section 1 of the General Commands Manual, bestie) ✨

okay so real talk: this is nullmailer-inject, and she's the little gremlin that takes your messy lil email, gives it a glow-up, and yeets it into the queue. let's get into it 🫢


✨ SYNOPSIS ✨

nullmailer-inject [-a] [-b] [-e] [-f sender] [-h] [recipient [recipient
...]]

🌸 DESCRIPTION 🌸

so basically: this program reads an email message from standard input, reformats its header so it complies with RFC822, and then sends the resulting message to the queue. that's the whole vibe. no cap. πŸ’…

πŸŽ€ HEADER FIELDS πŸŽ€

these lines get parsed for recipient addresses: To, Cc, Bcc, Apparently-To, Resent-To, Resent-Cc, and Resent-Bcc.

these sender address lines get parsed and rewritten: Sender, From, Reply-To, Return-Path, Return-Receipt-To, Errors-To, Resent-Sender, Resent-From, and Resent-Reply-To. and listen β€” if the Return-Path header field is present and contains a single address, its contents will be used to set the envelope sender address. she's got main character energy like that. πŸ‘‘

if the message contains any of these fields, it is treated as a resent message: Resent-Sender, Resent-From, Resent-Reply-To, Resent-To, Resent-Cc, Resent-Bcc, Resent-Date, Resent-Message-ID. and if the message is resent, only the recipient fields prefixed with Resent- are examined for addresses. iykyk.

any occurrences of Bcc, Resent-Bcc, Return-Path, or Content-Length are discarded after they are parsed (if necessary). gone. deleted. not me ghosting your Bcc πŸ«₯

if the header lacks a Message-Id field, a unique string is generated and added to the message. if the header lacks a Date field, the current local date and time in RFC822 format is appended to the message. and if the message has no To or Cc fields, the following line is appended to the message:

Cc: recipient list not shown: ;

πŸ¦‹ ADDRESS LISTS πŸ¦‹

address lists are expected to follow the syntax set out in RFC822. here's a simplified explanation of the syntax, bestie, because the full RFC is a lot:

an address list is a list of addresses separated by commas. an individual address may have one of the following three forms: user@fqdn, comment<user@fqdn>, or phrase:address-list;. any of the first two forms may be used within the address list of the third form. any word containing special characters must be placed in double quotes and the special characters must be preceded with a backslash. comments may be placed between addresses in parenthesis. all comments are ignored. (the comments, not you. you're seen. πŸ’–)

address lists are reformatted as they are parsed, for ease of later re-parsing when the message reaches the destination(s). and if an address is missing a fqdn, nullmailer-inject adds one. she's fixing you up, no questions asked ✨


πŸ’… OPTIONS πŸ’…

  • -a β€” use only the command line arguments as recipient addresses. ignore the header recipient lines entirely. bye πŸ‘‹
  • -b β€” use both the command line arguments and data from the message header as recipient addresses. why not both, honestly
  • -e β€” use either the command line arguments (if there are any) or data from the message header (if there are no arguments) as the recipient addresses
  • -f sender β€” set the envelope sender address to sender
  • -h β€” use only data from the message header as the recipient addresses
  • -n β€” do not queue the message, but print the reformatted contents to standard output. just lookin', not sending πŸ“
  • -v β€” print out the envelope (sender and recipient addresses) preceding the message when printing the message to standard output

⭐ RETURN VALUE ⭐

exits 0 if it was successful. otherwise it prints a diagnostic message to standard error and exits 1. slay or flop, no in-between πŸ’€


🌈 ENVIRONMENT 🌈

the environment variable NULLMAILER_FLAGS is parsed and the behavior of nullmailer-inject is modified if any of the following letters are present:

  • c β€” use "address (comment)" style in the generated From field instead of the default "comment <address>" style
  • f β€” ignore and remove any From header lines and always insert a generated one
  • i β€” ignore and remove any Message-Id header lines
  • s β€” ignore and remove any Return-Path header lines
  • t β€” insert a To line containing a list of the recipients if the header does not contain either a To or a Cc field. if the message is determined to be a resent message (see above πŸ‘†), a Resent-To field is added if the header does not contain either a Resent-To or a Resent-Cc field

the user name is set by NULLMAILER_USER, MAILUSER, USER, or LOGNAME, whichever comes first. if none of the above are set, the name is taken from the password file, or set to unknown if that fails. (so mysterious of her ✨)

the host name is set by the canonicalized value of NULLMAILER_HOST, MAILHOST, or HOSTNAME, whichever comes first, or the defaulthost config file if none of the above are set (see below).

the full name of the user is set by NULLMAILER_NAME, MAILNAME, NAME, or the user name above, whichever comes first.

the user and host name of the envelope sender default to the user and host name set above, but may be overridden by NULLMAILER_SUSER and NULLMAILER_SHOST.

if NULLMAILER_QUEUE is set, the program named is used in place of nullmailer-queue to queue the formatted message.


🧚 CONTROL FILES 🧚

when reading the following files, a single line is read and stripped of all leading and trailing whitespace characters. (she's not here for your extra spaces, bestie 🧼)

  • defaultdomain β€” the content of this file is appended to any host name that does not contain a period (except localhost), including defaulthost and idhost. defaults to the value of the /etc/mailname system file, if it exists, otherwise the literal name defauldomain.
  • defaulthost β€” the content of this file is appended to any address that is missing a host name. defaults to the value of the /etc/mailname system file, if it exists, otherwise the literal name defaulthost.
  • idhost β€” the content of this file is used when building the message-id string for the message. defaults to the canonicalized value of defaulthost.
  • /etc/mailname β€” the fully-qualifiled host name of the computer running nullmailer. defaults to the literal name me.

πŸ‘€ SEE ALSO πŸ‘€

nullmailer-queue(8)


πŸ’€ NOTES πŸ’€

this document glosses over very many details of how address parsing and rewriting actually works (among other things). yeah. it's giving "trust the process". πŸ™ˆ


and that's the whole page, bestie!! this was nullmailer-inject(1) from the General Commands Manual β€” version/date footer energy: nullmailer-inject(1) πŸŽ€ go forth and inject responsibly πŸ’–βœ¨πŸ¦‹