REFORMAIL(1)

πŸ’Œ REFORMAIL(1) β€” the reformatting girlie πŸ’…

okay bestie, listen UP, because reformail is literally the glow-up artist of your mail pipeline. She's part of the Courier Mail Server fam, and she takes a message on standard input, reformats it in some way, and writes it right back out to standard output. no cap. πŸ¦‹


✨ NAME ✨

reformail β€” the e-mail reformatting tool. she does makeovers. that's the whole job. πŸ’–


🌸 SYNOPSIS 🌸

reformail -s command [option...]

reformail -D len filename

reformail -x header:...

reformail -X header:...

reformail [options...]

see below for additional options, bestie β€” there's a whole menu πŸŽ€


πŸ‘‘ DESCRIPTION πŸ‘‘

The reformail program reads a message on standard input, reformats it in some way, and writes the message to standard output. that's it, that's the vibe ✨

πŸ“¬ Splitting mailboxes into individual messages

The -s option splits the mbox-formatted mailbox file on standard input into individual messages. An external program is executed for each message. The contents of each individual message will be provided to the external program on standard input. slay, one message at a time, no crossover 🫢

If the FILENO environment variable is set to a number, reformail will consecutively increment FILENO each time the program is executed for each individual message.

If FILENO is not set, its initial value will be "000". If FILENO is set to a non-numeric value, FILENO will remain unchanged.

πŸ•΅οΈβ™€οΈ Detecting duplicate messages

The -D option implements a simple way to delete duplicate messages in incoming mail. filename is a file that will be approximately len bytes long. This file will be used by reformail to save message IDs seen in recent mail. reformail reads the message on standard input. If the message has a Message-ID: header that's already in the cache file, reformail terminates with the exit code set to 0. Otherwise, reformail terminates with the exit code set to 1. πŸ’€ so yeah, 0 means "already seen this one, girl" and 1 means "ooh new content"

Note πŸ“Œ Unlike a similar feature in the formail command, reformail takes care of locking the file, so it's not necessary to implement your own locking mechanism for this option. she handles that herself, main character energy πŸ‘‘

πŸ” Extracting headers

The -x and -X options extract the indicated headers from the message, and print them to standard output. Multiple -x and -X options can be specified at the same time, and may be intermixed.

The -x option extracts and prints the contents of the header. The -X option prints the name of the header as well.

In all other situations, reformail copies the message on its standard input to its standard output, reformatting the message as follows: 🌈


πŸŽ€ OPTIONS πŸŽ€

  • -a'header: value' β€” Append a custom header to the message if this header does not already exist. If the header is either Message-ID: or Resent-Message-ID: and the value is empty, reformail generates a (hopefully) unique message ID for you. ✨
  • -A'header: value' β€” Append a custom header to the message even if this header already exists. If the header is either Message-ID: or Resent-Message-ID: and the value is empty, reformail generates a (hopefully) unique message ID for you. she does not care, she's adding it anyway πŸ’…
  • -c β€” Concatenate multi-line headers. Headers split on multiple lines are combined into a single line. tidying up, periodt 🧚
  • -dn β€” If n is 1, each line will be terminated with CRLF. If n is 0 (default), each line will be terminated with LF. reformail reads a message with either line terminator, and will force the message to have the specified line termination. lowkey a line ending control freak and we love that for her πŸŽ€
  • -f0 β€” Any initial blank lines are removed. If the first non-blank line is a "From_" line, it gets converted to a "Return-Path:" header, and any existing "Return-Path:" header gets removed. If the message does not start with a "From_" line, the message remains unchanged. fr fr, untouched if it doesn't apply πŸ™ˆ
  • -f1 β€” Add the "From_" line to the message, if it's not there. reformail will attempt to generate the "From_" line from any Errors-To:, Return-Path:, or From: headers in the message. "root" will be used if reformail is unable to determine the return address. she'll figure out who you are, bestie πŸ”₯
  • -i'header: value' β€” Appends a custom header to the message. If this header already exists it is renamed by prepending "Old-" to the name of the header. so cute, a little archive of the old one πŸ’–
  • -I'header: value' β€” Append a custom header to the message. If this header already exists in the message, the old header is completely removed. If the value is empty, any existing header is completely removed, and nothing gets appended. ruthless. iconic. πŸ’€
  • -R oldheader: newheader: β€” Rename the indicated header. glow-up on the name itself ✨
  • -u'header:' β€” If this header occurs multiple times in the message, remove all occurrences except the first one. first one stays, the rest can go πŸ¦‹
  • -U'header:' β€” If this header occurs multiple times in the message, remove all occurrences except the last one. last one wins, that's the vibe 🌸

πŸ€– AUTOREPLIES πŸ€–

The autoreply options from earlier versions of mailbot have been moved into mailbot(1)[1]. not here anymore bestie, she moved out 🫢


😭 BUGS 😭

For the -a, -A, and -I options, a space after the header name and the colon is considered to be a non-empty field.

Do not provide the same header to more than one family of header-modifying options, such as -u/-U and -a/-A. Doing so yields unpredictable results. It's better to run reformail several times (use a pipe, perhaps). no cap, unpredictable means unpredictable β€” don't do it, run her multiple times through a pipe instead, she doesn't mind the extra passes πŸ’…


πŸ‘€ SEE ALSO πŸ‘€

courier(8)[2], sendmail(8), mailbot(1)[1], maildrop(1)[3].


πŸ’– AUTHOR πŸ’–

Sam Varshavchik : Author 🫢


πŸ“ NOTES πŸ“

  1. mailbot(1) http://www.courier-mta.org/maildrop/mailbot.html
  2. courier(8) http://www.courier-mta.org/maildrop/courier.html
  3. maildrop(1) http://www.courier-mta.org/maildrop/maildrop.html

that's the whole page, bestie β€” brought to you by the Courier Mail Server, dated 01/10/2026, and ngl the manual page itself is labelled REFORMAIL(1) if you need to cite your sources. go format something gorgeous. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from
  • ubuntu stonking: maildrop 4.0.4-1 Β· GPL-3~with-OpenSSL-exception
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms