1TNEF(1) General Commands Manual TNEF(1)
2
3
4
6 tnef - decode Microsoft's Transport Neutral Encapsulation Format
7
9 tnef [options] [FILE]
10
11 tnef {--help | --version}
12
14 This manual page documents the tnef filter. tnef decodes e-mail
15 attachments encoded in Microsoft's Transport Neutral Encapsulation For‐
16 mat (hereafter, TNEF), which "wraps" Microsoft e-mail attachments.
17
18 Unfortunately, these "wrapped" attachments are inaccessible to any e-
19 mail client that does not understand TNEF. Fortunately, the tnef fil‐
20 ter can be used by any MIME-aware client to unpack these attachments.
21
23 -f FILE, --file=FILE
24 use FILE as input ('-' denotes stdin). When this option is
25 omitted, tnef reads data from stdin.
26
27 -C DIR, --directory=DIR
28 unpack file attachments into DIR.
29
30 -x SIZE, --maxsize=SIZE
31 limit maximum size of extracted archive (bytes)
32
33 -t, --list
34 list attached files, do not extract. For each file in the
35 datafile the file name and full path will be printed.
36
37 If the verbose option is also provided then this option acts as
38 the --list-with-mime-types option and also prints the file
39 length (in bytes) and the date of the file before the other
40 data.
41
42
43 --list-with-mime-types
44 same as list option but also prints MIME type and content ID of
45 each file after filename and file path.
46
47
48 -w, --interactive, --confirmation
49 ask for confirmation for every action.
50
51 --overwrite
52 when extracting attachments, overwrite existing files.
53
54 --number-backups
55 when extracting attachments, if file FOO will be overwritten,
56 create FOO.n instead.
57
58 --use-paths
59 honor file pathnames specified in the TNEF attachment. For
60 security reasons, paths to attached files are ignored by
61 default.
62
63 --save-body FILE
64 Save message body data found in the TNEF data. By default tnef
65 only extracts the attached files and not the message body.
66
67 There can be up to three message bodies in the file, plain text,
68 HTML encoded, and RTF encoded. Which are saved is specified by
69 the --body-pref option. By default the message bodies are writ‐
70 ten to a file named message with an extension based upon the
71 type (txt, html, rtf).
72
73 --body-pref PREF
74 Specifies which of the possibly three message body formats will
75 be saved. PREF can be up to three characters long and each
76 character must be one of 'r', 'h', or 't' specifying RTF, HTML
77 or text. The order is the order that the data will be checked,
78 the first type found will be saved. If PREF is the special
79 value of 'all' then any and all message body data found will be
80 saved. The default is 'rht'.
81
82 --save-rtf FILE
83 DEPRECATED. Equivalent to --save-body=FILE --body-pref=r
84
85 -h, --help
86 show usage message.
87
88 -V, --version
89 display version and copyright.
90
91 -v, --verbose
92 produce verbose output.
93
94 --debug
95 enable debug output. (This will produce a very large amount of
96 output.)
97
99 tnef ignores the OEMCodePage data in the data file. It assumes Unicode
100 data.
101
103 The following example demonstrates typical tnef usage with a popular
104 Unix mail client called "mutt".
105
106 Step 1 — Configure ~/.mailcap
107 Mutt can't use tnef for its intended purpose until an appropriate con‐
108 tent type definition exists in ~/.mailcap. Here's a sample definition:
109
110 application/ms-tnef; tnef -w %s
111
112 This mailcap entry says that whenever the MIME content type:
113
114 application/ms-tnef
115
116 is encountered, use this command to decode it:
117
118 tnef -w %s
119
120 The latter command string invokes tnef, specifying both the -w option
121 and the attachment (created as a temporary file) as command line argu‐
122 ments.
123
124 Step 2 — Add The Filter To $PATH
125 Mutt can't invoke tnef if the filter isn't accessible via $PATH.
126
127 Step 3 — Test Mutt
128 Use mutt to read a message that includes a TNEF attachment. Mutt will
129 note that an attachment of type "application/ms-tnef is unsupported".
130
131 Press the "v" key to open mutt's "view attachment" menu.
132
133 Move the cursor over the TNEF attachment and press the enter key to
134 "view" the attachment. Mutt will launch tnef and invoke it using the
135 command line syntax specified in ~/.mailcap (step 1). tnef then de‐
136 codes all file(s) included in the TNEF attachment, prompting for con‐
137 firmation prior to creating an individual file (refer to -w option
138 above). -w is useful here because it gives the end user a chance to
139 view the filename(s) included in the mail message.
140
141 Note that Mutt's attachment menu also supports a pipe option, which
142 permits the user to pipe attachments to an external filter (how conve‐
143 nient). So, to list the contents of a TNEF attachment prior to decod‐
144 ing it, press the "|" key and enter this command:
145
146 tnef -t
147
149 metamail(1), mailcap(4), mutt(1), other email clients.
150
152 Mark Simpson <verdammelt@gmail.com>
153
155 Please report issues via this project's issue tracker on GitHub:
156 https://github.com/verdammelt/tnef/issues
157
158
160 This web page:
161
162 https://www.dwheeler.com/essays/microsoft-outlook-tnef.html
163
164 describes how to configure Microsoft email clients so that the TNEF
165 format is disabled when sending messages to non-TNEF-compatible
166 clients.
167
168
169
170 TNEF(1)