TNEF(1)
π TNEF(1) β the tnef filter, explained by your favorite Unix bestie π
okay so. you've got one of those cursed Microsoft email attachments and it's just... sitting there. not opening. girl, I got you. this is the General Commands Manual page for tnef, and we're gonna unpack the whole thing together π«Ά
β¨ NAME β¨
tnef β decode Microsoft's Transport Neutral Encapsulation Format. yes that's a real thing, no I'm not making it up π
π¦ SYNOPSIS π¦
tnef [options] [FILE]
tnef {--help | --version}
πΈ DESCRIPTION πΈ
This page documents the tnef filter, bestie. So tnef decodes e-mail attachments that are encoded in Microsoft's Transport Neutral Encapsulation Format (from here on out we're calling it TNEF, because saying the whole thing every time is exhausting). Basically TNEF "wraps" Microsoft e-mail attachments. It's giving β¨mystery giftβ¨ but make it unusable.
And here's the tea: those "wrapped" attachments are literally inaccessible to any e-mail client that doesn't understand TNEF. Like, locked out. π But good news!! The tnef filter can be used by any MIME-aware client to unpack these attachments. we love a savior moment π
π OPTIONS π
-f FILE,--file=FILEβ use FILE as the input. if you pass-that means stdin, iconic. When you don't use this option at all,tnefjust reads the data from stdin anyway. no pressure.-C DIR,--directory=DIRβ unpack the file attachments into DIR. cute little home for them π-x SIZE,--maxsize=SIZEβ caps the maximum size of the extracted archive, measured in bytes. a lil boundary, we respect it.-t,--listβ list the attached files, do not extract. For every file in the datafile, the file name and the full path get printed. just a lil peek, no touching π
If the verbose option is also provided then this option acts as the --list-with-mime-types option, and it also prints the file length (in bytes) and the date of the file, before the other data. so you get the whole picture, front to back.
--list-with-mime-typesβ same as the list option but it also prints the MIME type and content ID of each file, after the filename and file path. extra detail, extra slay.-w,--interactive,--confirmationβ ask for confirmation for every single action. yes ma'am, consent checks only π«Ά--overwriteβ when extracting attachments, overwrite existing files. bold. fearless. lowkey terrifying.--number-backupsβ when extracting attachments, if the fileFOOis about to be overwritten, createFOO.ninstead. the way it just... numbers them π--use-pathsβ honor the file pathnames specified in the TNEF attachment. β οΈ heads up bestie: for security reasons, paths to attached files are ignored by default. this flag turns that safety off, so know what you're doing.--save-body FILEβ save the message body data found in the TNEF data. By defaulttnefonly extracts the attached files and not the message body. There can be up to three message bodies in the file: plain text, HTML encoded, and RTF encoded. Which ones get saved is specified by the--body-prefoption. By default the message bodies are written to a file namedmessagewith an extension based upon the type (txt,html,rtf).--body-pref PREFβ specifies which of the possibly three message body formats will be saved. PREF can be up to three characters long, and each character must be one of'r','h', or't', specifying RTF, HTML or text. The order is the order that the data will be checked, and the first type found will be saved. If PREF is the special value of'all'then any and all message body data found will be saved. The default is'rht'. choose your own adventure β¨--save-rtf FILEβ DEPRECATED. Equivalent to--save-body=FILE --body-pref=r. it's giving legacy, we still list it tho π-h,--helpβ show the usage message. everybody's favorite.-V,--versionβ display version and copyright.-v,--verboseβ produce verbose output. spill everything π£οΈ--debugβ enable debug output. (This will produce a very large amount of output.) like, genuinely a lot. do not say I didn't warn you.
β οΈ KNOWN LIMITATIONS β οΈ
tnef ignores the OEMCodePage data in the data file. It assumes Unicode data. that's the whole limitation, periodt.
π EXAMPLE π
The following example demonstrates typical tnef usage with a popular Unix mail client called "mutt". let's walk through it together, step by step π§
β Step 1 β Configure ~/.mailcap
Mutt can't use tnef for its intended purpose until an appropriate content type definition exists in ~/.mailcap. Here's a sample definition:
application/ms-tnef; tnef -w %s
This mailcap entry says that whenever the MIME content type:
application/ms-tnef
is encountered, use this command to decode it:
tnef -w %s
The latter command string invokes tnef, specifying both the -w option and the attachment (created as a temporary file) as command line arguments. chef's kiss π€
β Step 2 β Add The Filter To $PATH
Mutt can't invoke tnef if the filter isn't accessible via $PATH. no path, no party.
β Step 3 β Test Mutt
Use mutt to read a message that includes a TNEF attachment. Mutt will note that an attachment of type "application/ms-tnef is unsupported".
Press the "v" key to open mutt's "view attachment" menu.
Move the cursor over the TNEF attachment and press the enter key to "view" the attachment. Mutt will launch tnef and invoke it using the command line syntax specified in ~/.mailcap (step 1). tnef then decodes all file(s) included in the TNEF attachment, prompting for confirmation prior to creating an individual file (refer to the -w option above). -w is useful here because it gives the end user a chance to view the file name(s) included in the mail message. love that for us π
ngl, Mutt's attachment menu also supports a pipe option, which permits the user to pipe attachments to an external filter (how convenient). So, to list the contents of a TNEF attachment prior to decoding it, press the "|" key and enter this command:
tnef -t
π SEE ALSO π
metamail(1), mailcap(4), mutt(1), other email clients.
π«Ά AUTHOR π«Ά
Mark Simpson <verdammelt@gmail.com>
π REPORTING BUGS π
Please report issues via this project's issue tracker on GitHub: https://github.com/verdammelt/tnef/issues
π OTHER REFERENCES π
This web page:
https://www.dwheeler.com/essays/microsoft-outlook-tnef.html
describes how to configure Microsoft email clients so that the TNEF format is disabled when sending messages to non-TNEF-compatible clients. go read it, it's a whole vibe β
and that's the whole page bestie!! this was the TNEF(1) page straight out of the General Commands Manual β same name up top, same name at the bottom, no notes π
β¨ mwah π
π¦ where this page comes from
- debian bookworm: tnef 1.4.18-3 Β· GPL-2.0-or-later
- debian trixie: tnef 1.4.18-4 Β· GPL-2.0-or-later
- fedora 43: tnef 1.4.18-12.fc41 Β· GPLv2+
- fedora 43: tnef 1.4.18-16.fc43 Β· GPL-2.0-or-later
- fedora 44: tnef 1.4.18-17.fc44 Β· GPL-2.0-or-later
- nixos 26.05: tnef 1.4.18
- nixpkgs unstable: tnef 1.4.18
- opensuse-leap 16.0: tnef 1.4.18-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: tnef 1.4.18-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: tnef 1.4.18-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: tnef 1.4.18-bp160.1.12 Β· GPL-2.0-or-later
- ubuntu jammy: tnef 1.4.18-3 Β· GPL-2.0-or-later
- ubuntu noble: tnef 1.4.18-3 Β· GPL-2.0-or-later
- ubuntu questing: tnef 1.4.18-5
- ubuntu resolute: tnef 1.4.18-5build1 Β· GPL-2.0-or-later
- ubuntu stonking: tnef 1.4.18-6 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms