faf8ea5d64ccf041310f4bf96fd812194507dc1d
[mmh] / man / mhstore.man1
1 .\"
2 .\" %nmhwarning%
3 .\"
4 .TH MHSTORE %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
5 .SH NAME
6 mhstore \- store contents of MIME messages into files
7 .SH SYNOPSIS
8 .HP 5
9 .na
10 .B mhstore
11 .RI [ +folder ]
12 .RI [ msgs ]
13 .RB [ \-file
14 .IR file ]
15 .RB [ \-part
16 .IR number ]
17 \&...
18 .RB [ \-type
19 .IR content ]
20 \&...
21 .RB [ \-auto " | " \-noauto ]
22 .RB [ \-version ]
23 .RB [ \-help ]
24 .ad
25 .SH DESCRIPTION
26 The
27 .B mhstore
28 command allows you to store the contents of a
29 collection of MIME (multi-media) messages into files or other
30 messages.
31 .PP
32 .B mhstore
33 manipulates multi-media messages as specified in
34 RFC\-2045 thru RFC\-2049.
35 .PP
36 By default,
37 .B mhstore
38 will store all the parts of each message.
39 Each part will be store in a separate file.  The header fields of
40 the message are not stored.  By using the
41 .B \-part
42 and
43 .B \-type
44 switches, you may limit the scope of
45 .B mhstore
46 to particular
47 subparts (of a multipart content) and/or particular content types.
48 .PP
49 The option
50 .B \-file
51 .I file
52 directs
53 .B mhstore
54 to use the specified
55 file as the source message, rather than a message from a folder.
56 If you specify this file as \*(lq-\*(rq, then
57 .B mhstore
58 will
59 accept the source message on the standard input.  Note that the
60 file, or input from standard input should be a validly formatted
61 message, just like any other
62 .B nmh
63 message.  It should
64 .B NOT
65 be in mail drop format (to convert a file in mail drop format to
66 a folder of
67 .B nmh
68 messages, see
69 .BR inc (1)).
70 .PP
71 A part specification consists of a series of numbers separated by
72 dots.  For example, in a multipart content containing three parts,
73 these would be named as 1, 2, and 3, respectively.  If part 2 was
74 also a multipart content containing two parts, these would be named
75 as 2.1 and 2.2, respectively.  Note that the
76 .B \-part
77 switch is
78 effective for only messages containing a multipart content.  If a
79 message has some other kind of content, or if the part is itself
80 another multipart content, the
81 .B \-part
82 switch will not prevent
83 the content from being acted upon.
84 .PP
85 A content specification consists of a content type and a subtype.
86 The initial list of \*(lqstandard\*(rq content types and subtypes
87 can be found in RFC\-2046.
88 .PP
89 A list of commonly used contents is briefly reproduced here:
90 .PP
91 .RS 5
92 .nf
93 .ta \w'application  'u
94 Type    Subtypes
95 ----    --------
96 text    plain, enriched
97 multipart       mixed, alternative, digest, parallel
98 message rfc822, partial, external-body
99 application     octet-stream, postscript
100 image   jpeg, gif, png
101 audio   basic
102 video   mpeg
103 .fi
104 .RE
105 .PP
106 A legal MIME message must contain a subtype specification.
107 .PP
108 To specify a content, regardless of its subtype, just use the name
109 of the content, e.g., \*(lqaudio\*(rq.  To specify a specific
110 subtype, separate the two with a slash, e.g., \*(lqaudio/basic\*(rq.
111 Note that regardless of the values given to the
112 .B \-type
113 switch,
114 a multipart content (of any subtype listed above) is always acted
115 upon.  Further note that if the
116 .B \-type
117 switch is used, and it is
118 desirable to act on a message/external-body content, then the
119 .B \-type
120 switch must be used twice: once for message/external-body
121 and once for the content externally referenced.
122 .SS "Storing the Contents"
123 The
124 .B mhstore
125 will store the contents of the named messages in
126 \*(lqnative\*(rq (decoded) format.  Two things must be determined:
127 the directory to store the content, and the filenames.  Files are
128 written in the directory given by the \*(lqnmh-storage\*(rq profile
129 entry, e.g.,
130 .PP
131 .RS 5
132 nmh-storage: /tmp
133 .RE
134 .PP
135 If this entry isn't present,
136 the current working directory is used.
137 .PP
138 By default (or if the
139 .B \-auto
140 switch is given), then
141 .B mhstore
142 will check if
143 the message contains information indicating the filename that should
144 be used to store the content.  This information should be specified
145 as the attribute \*(lqname=filename\*(rq in the \*(lqContent-Type\*(rq header
146 for the content you are storing.  For security reasons, this filename
147 will be ignored if it begins with the character '/', '.', '|', or '!',
148 or if it contains the character '%'. Now that tar files are not extracted
149 automatically anymore, having
150 .B \-auto
151 as the default is quite safe.
152 Attachments are only stored below the current (or the storage)
153 directory. In the worst case, existing files there will be overwritten.
154 .PP
155 If the
156 .B \-auto
157 switch is not given (or is being ignored for security
158 reasons) then
159 .B mhstore
160 will look in the user's profile for a
161 \*(lqformatting string\*(rq to determine how the different contents
162 should be stored.  First,
163 .B mhstore
164 will look for an entry of
165 the form:
166 .PP
167 .RS 5
168 mhstore-store-<type>/<subtype>
169 .RE
170 .PP
171 to determine the formatting string.  If this isn't found,
172 .B mhstore
173 will look for an entry of the form:
174 .PP
175 .RS 5
176 mhstore-store-<type>
177 .RE
178 .PP
179 to determine the formatting string.
180 .PP
181 If the formatting string starts with a \*(lq+\*(rq character, then
182 content is stored in the named folder.  A formatting string consisting
183 solely of a \*(lq+\*(rq character is interpreted to be the current
184 folder.
185 .PP
186 If the formatting string consists solely of a \*(lq-\*(rq character,
187 then the content is sent to the standard output.
188 .PP
189 If the formatting string starts with a '|', then the display string
190 will represent a command for
191 .B mhstore
192 to execute which should
193 ultimately store the content.  The content will be passed to the
194 standard input of the command.  Before the command is executed,
195 .B mhstore
196 will change to the appropriate directory, and any
197 escapes (given below) in the display string will be expanded.
198 .PP
199 Otherwise the formatting string will represent a pathname in which
200 to store the content.  If the formatting string starts with a '/',
201 then the content will be stored in the full path given, else the
202 file name will be relative to the value of \*(lqnmh-storage\*(rq or
203 the current working directory.  Any escapes (given below) will be
204 expanded, except for the a-escape.  Note that if \*(lqnmh-storage\*(rq
205 is not an absolute path, it will be relative to the folder that
206 contains the message(s).
207 .PP
208 A command or pathname formatting string may contain the following
209 escapes.  If the content isn't part of a multipart (of any subtype
210 listed above) content, the p-escapes are ignored.
211 .PP
212 .RS 5
213 .nf
214 .ta \w'%P  'u
215 %a      Parameters from Content-type  (only valid with command)
216 %m      Insert message number
217 %P      Insert part number with leading dot
218 %p      Insert part number without leading dot
219 %t      Insert content type
220 %s      Insert content subtype
221 %%      Insert character %
222 .fi
223 .RE
224 .PP
225 If no formatting string is found,
226 .B mhstore
227 will check to see if the content is a message.  If
228 so,
229 .B mhstore
230 will use the value \*(lq+\*(rq.  As a last resort,
231 .B mhstore
232 will use the value \*(lq%m%P.%s\*(rq.
233 .PP
234 Example profile entries might be:
235 .PP
236 .RS 5
237 .nf
238 mhstore-store-text: %m%P.txt
239 mhstore-store-text: +inbox
240 mhstore-store-message/partial: +
241 mhstore-store-audio/basic: | raw2audio -e ulaw -s 8000 -c 1 > %m%P.au
242 mhstore-store-image/jpeg: %m%P.jpg
243 mhstore-store-application/PostScript: %m%P.ps
244 .fi
245 .RE
246 .PP
247 .SS "Reassembling Messages of Type message/partial"
248 .B mhstore
249 is also able to reassemble messages that have been
250 split into multiple messages of type \*(lqmessage/partial\*(rq.
251 .PP
252 When asked to store a content containing a partial message,
253 .B mhstore
254 will try to locate all of the portions and combine
255 them accordingly.  The default is to store the combined parts as
256 a new message in the current folder, although this can be changed
257 using formatting strings as discussed above.  Thus, if someone has
258 sent you a message in several parts (such as the output from
259 .BR sendfiles ),
260 you can easily reassemble them all into a single
261 message in the following fashion:
262 .PP
263 .RS 5
264 .nf
265 % mhlist 5-8
266  msg part  type/subtype             size description
267    5       message/partial           47K part 1 of 4
268    6       message/partial           47K part 2 of 4
269    7       message/partial           47K part 3 of 4
270    8       message/partial           18K part 4 of 4
271 % mhstore 5-8
272 reassembling partials 5,6,7,8 to folder inbox as message 9
273 % mhlist 9
274  msg part  type/subtype             size description
275    9       application/octet-stream 118K
276              (extract with uncompress | tar xvpf -)
277              type=tar
278              conversions=compress
279 .fi
280 .RE
281 .PP
282 This will store exactly one message, containing the sum of the
283 parts.  It doesn't matter whether the partials are specified in
284 order, since
285 .B mhstore
286 will sort the partials, so that they
287 are combined in the correct order.  But if
288 .B mhstore
289 can not
290 locate every partial necessary to reassemble the message, it will
291 not store anything.
292 .RE
293 .SS "External Access"
294 For contents of type message/external-body,
295 \fImhstore\fR supports these access-types:
296 .PP
297 .IP \(bu 4
298 afs
299 .IP \(bu 4
300 anon-ftp
301 .IP \(bu 4
302 ftp
303 .IP \(bu 4
304 local-file
305 .IP \(bu 4
306 mail-server
307 .PP
308 For the \*(lqanon-ftp\*(rq and \*(lqftp\*(rq access types,
309 .B mhstore
310 will look for the \*(lqnmh-access-ftp\*(rq
311 profile entry, e.g.,
312 .PP
313 .RS 5
314 nmh-access-ftp: myftp.sh
315 .RE
316 .PP
317 to determine the pathname of a program to perform the FTP retrieval.
318 This program is invoked with these arguments:
319 .PP
320 .RS 5
321 .nf
322 domain name of FTP-site
323 username
324 password
325 remote directory
326 remote filename
327 local filename
328 \*(lqascii\*(rq or \*(lqbinary\*(rq
329 .fi
330 .RE
331 .PP
332 The program should terminate with an exit status of zero if the
333 retrieval is successful, and a non-zero exit status otherwise.
334 .SS "User Environment"
335 Because the display environment in which
336 .B mhstore
337 operates may vary for
338 different machines,
339 .B mhstore
340 will look for the environment variable
341 .BR $MHSTORE .
342 If present, this specifies the name of an additional
343 user profile which should be read.  Hence, when a user logs in on a
344 particular machine, this environment variable should be set to
345 refer to a file containing definitions useful for that machine.
346 Finally,
347 .B mhstore
348 will attempt to consult one other additional
349 user profile, e.g.,
350 .PP
351 .RS 5
352 %etcdir%/mhn.defaults
353 .RE
354 .PP
355 which is created automatically during
356 .B nmh
357 installation.
358
359 .SH FILES
360 .fc ^ ~
361 .nf
362 .ta \w'%etcdir%/ExtraBigFileName  'u
363 ^$HOME/.mmh/profile~^The user profile
364 ^$MHSTORE~^Additional profile entries
365 ^%etcdir%/mhn.defaults~^System default MIME profile entries
366 .fi
367
368 .SH "PROFILE COMPONENTS"
369 .fc ^ ~
370 .nf
371 .ta 2.4i
372 .ta \w'ExtraBigProfileName  'u
373 ^Path:~^To determine the user's mail storage
374 ^Current\-Folder:~^To find the default current folder
375 ^nmh-access-ftp:~^Program to retrieve contents via FTP
376 ^nmh-storage~^Directory to store contents
377 ^mhstore-store-<type>*~^Template for storing contents
378 .fi
379
380 .SH "SEE ALSO"
381 mhbuild(1), mhlist(1), mhshow(1), sendfiles(1)
382
383 .SH DEFAULTS
384 .nf
385 .RB ` +folder "' defaults to the current folder"
386 .RB ` msgs "' defaults to cur"
387 .RB ` \-auto '
388
389 .SH CONTEXT
390 If a folder is given, it will become the current folder.  The last
391 message selected will become the current message.
392
393 .SH BUGS
394 Partial messages contained within a multipart content are not reassembled.