1Mail::Box::Mbox(3)    User Contributed Perl Documentation   Mail::Box::Mbox(3)
2
3
4

NAME

6       Mail::Box::Mbox - handle folders in Mbox format
7

INHERITANCE

9        Mail::Box::Mbox
10          is a Mail::Box::File
11          is a Mail::Box
12          is a Mail::Reporter
13

SYNOPSIS

15        use Mail::Box::Mbox;
16        my $folder = Mail::Box::Mbox->new(folder => $ENV{MAIL}, ...);
17

DESCRIPTION

19       This documentation describes how Mbox mailboxes work, and also
20       describes what you can do with the Mbox folder object Mail::Box::Mbox.
21

OVERLOADED

23       overload: ""
24
25           See "OVERLOADED" in Mail::Box
26
27       overload: @{}
28
29           See "OVERLOADED" in Mail::Box
30
31       overload: cmp
32
33           See "OVERLOADED" in Mail::Box
34

METHODS

36       Constructors
37
38       Mail::Box::Mbox->new(OPTIONS)
39
40        Option             --Defined in     --Default
41        access               Mail::Box        'r'
42        body_delayed_type    Mail::Box        Mail::Message::Body::Delayed
43        body_type            Mail::Box::File  <see description>
44        coerce_options       Mail::Box        []
45        create               Mail::Box        <false>
46        extract              Mail::Box        10240
47        field_type           Mail::Box        undef
48        fix_headers          Mail::Box        <false>
49        folder               Mail::Box        $ENV{MAIL}
50        folderdir            Mail::Box        $ENV{HOME}.'/Mail'
51        head_delayed_type    Mail::Box        Mail::Message::Head::Delayed
52        head_type            Mail::Box        Mail::Message::Head::Complete
53        keep_dups            Mail::Box        <false>
54        lock_extension       Mail::Box::File  '.lock'
55        lock_file            Mail::Box        <foldername><lock-extension>
56        lock_timeout         Mail::Box        1 hour
57        lock_type            Mail::Box        Mail::Box::Locker::DotLock
58        lock_wait            Mail::Box        10 seconds
59        locker               Mail::Box        undef
60        log                  Mail::Reporter   'WARNINGS'
61        manager              Mail::Box        undef
62        message_type         Mail::Box        Mail::Box::Mbox::Message
63        multipart_type       Mail::Box        Mail::Message::Body::Multipart
64        remove_when_empty    Mail::Box        <true>
65        save_on_exit         Mail::Box        <true>
66        subfolder_extension                   '.d'
67        trace                Mail::Reporter   'WARNINGS'
68        trusted              Mail::Box        <depends on folder location>
69        write_policy         Mail::Box::File  undef
70
71           . access MODE
72
73           . body_delayed_type CLASS
74
75           . body_type CLASS⎪CODE
76
77           . coerce_options ARRAY
78
79           . create BOOLEAN
80
81           . extract INTEGER ⎪ CODE ⎪ METHOD ⎪ 'LAZY'⎪'ALWAYS'
82
83           . field_type CLASS
84
85           . fix_headers BOOLEAN
86
87           . folder FOLDERNAME
88
89           . folderdir DIRECTORY
90
91           . head_delayed_type CLASS
92
93           . head_type CLASS
94
95           . keep_dups BOOLEAN
96
97           . lock_extension FILENAME⎪STRING
98
99           . lock_file FILENAME
100
101           . lock_timeout SECONDS
102
103           . lock_type CLASS⎪STRING⎪ARRAY
104
105           . lock_wait SECONDS
106
107           . locker OBJECT
108
109           . log LEVEL
110
111           . manager MANAGER
112
113           . message_type CLASS
114
115           . multipart_type CLASS
116
117           . remove_when_empty BOOLEAN
118
119           . save_on_exit BOOLEAN
120
121           . subfolder_extension STRING
122
123               Mbox folders do not support sub-folders.  However, this module
124               can simulate sub-directories if the user wants it to.  When a
125               subfolder of folder "xyz" is created, we create a directory
126               which is called "xyz.d" to contain them.  This extension ".d"
127               can be changed using this option.
128
129           . trace LEVEL
130
131           . trusted BOOLEAN
132
133           . write_policy 'REPLACE'⎪'INPLACE'⎪undef
134
135       The folder
136
137       $obj->addMessage(MESSAGE, OPTIONS)
138
139           See "The folder" in Mail::Box
140
141       $obj->addMessages(MESSAGE [, MESSAGE, ...])
142
143           See "The folder" in Mail::Box
144
145       Mail::Box::Mbox->appendMessages(OPTIONS)
146
147           See "METHODS" in Mail::Box::File
148
149       $obj->close(OPTIONS)
150
151           See "The folder" in Mail::Box
152
153       $obj->copyTo(FOLDER, OPTIONS)
154
155           See "The folder" in Mail::Box
156
157       $obj->delete(OPTIONS)
158
159           See "The folder" in Mail::Box
160
161       $obj->filename
162
163           See "The folder" in Mail::Box::File
164
165       $obj->folderdir([DIRECTORY])
166
167           See "The folder" in Mail::Box
168
169       $obj->name
170
171           See "The folder" in Mail::Box
172
173       $obj->organization
174
175           See "The folder" in Mail::Box
176
177       $obj->size
178
179           See "The folder" in Mail::Box
180
181       $obj->type
182
183           See "The folder" in Mail::Box
184
185       $obj->update(OPTIONS)
186
187           See "The folder" in Mail::Box
188
189       $obj->url
190
191           See "The folder" in Mail::Box
192
193       Folder flags
194
195       $obj->access
196
197           See "Folder flags" in Mail::Box
198
199       $obj->isModified
200
201           See "Folder flags" in Mail::Box
202
203       $obj->modified([BOOLEAN])
204
205           See "Folder flags" in Mail::Box
206
207       $obj->writable
208
209           See "Folder flags" in Mail::Box
210
211       The messages
212
213       $obj->current([NUMBER⎪MESSAGE⎪MESSAGE-ID])
214
215           See "The messages" in Mail::Box
216
217       $obj->find(MESSAGE-ID)
218
219           See "The messages" in Mail::Box
220
221       $obj->findFirstLabeled(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
222
223           See "The messages" in Mail::Box
224
225       $obj->message(INDEX [,MESSAGE])
226
227           See "The messages" in Mail::Box
228
229       $obj->messageId(MESSAGE-ID [,MESSAGE])
230
231           See "The messages" in Mail::Box
232
233       $obj->messageIds
234
235           See "The messages" in Mail::Box
236
237       $obj->messages(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
238
239           See "The messages" in Mail::Box
240
241       $obj->nrMessages(OPTIONS)
242
243           See "The messages" in Mail::Box
244
245       $obj->scanForMessages(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
246
247           See "The messages" in Mail::Box
248
249       Sub-folders
250
251       $obj->listSubFolders(OPTIONS)
252
253       Mail::Box::Mbox->listSubFolders(OPTIONS)
254
255        Option             --Defined in     --Default
256        check                Mail::Box        <false>
257        folder               Mail::Box        <from calling object>
258        folderdir            Mail::Box        <from folder>
259        skip_empty           Mail::Box        <false>
260        subfolder_extension                   <from object>
261
262           . check BOOLEAN
263
264           . folder FOLDERNAME
265
266           . folderdir DIRECTORY
267
268           . skip_empty BOOL
269
270           . subfolder_extension STRING
271
272               When the method is called on an open folder, the extension
273               defined by it is used to detect sub-folders by default.  Other‐
274               wise, '.d' is taken.
275
276       $obj->nameOfSubFolder(SUBNAME, [PARENTNAME])
277
278       Mail::Box::Mbox->nameOfSubFolder(SUBNAME, [PARENTNAME])
279
280           See "Sub-folders" in Mail::Box
281
282       $obj->openRelatedFolder(OPTIONS)
283
284           See "Sub-folders" in Mail::Box
285
286       $obj->openSubFolder(SUBNAME, OPTIONS)
287
288           See "Sub-folders" in Mail::Box
289
290       $obj->topFolderWithMessages
291
292       Mail::Box::Mbox->topFolderWithMessages
293
294           See "Sub-folders" in Mail::Box
295
296       Internals
297
298       $obj->coerce(MESSAGE, OPTIONS)
299
300           See "Internals" in Mail::Box
301
302       $obj->create(FOLDERNAME, OPTIONS)
303
304       Mail::Box::Mbox->create(FOLDERNAME, OPTIONS)
305
306        Option             --Defined in     --Default
307        folderdir            Mail::Box        undef
308        subfolder_extension                   undef
309
310           . folderdir DIRECTORY
311
312           . subfolder_extension STRING
313
314               If a directory is found on the location of the folder to be
315               created, this STRING is used to extend that directory name
316               with.  This will cause the directory to be seen as sub-folder
317               for the created folder.  This argument is passed to fold‐
318               erToFilename().
319
320       $obj->determineBodyType(MESSAGE, HEAD)
321
322           See "Internals" in Mail::Box
323
324       $obj->folderToFilename(FOLDERNAME, FOLDERDIR, [EXTENSION])
325
326       Mail::Box::Mbox->folderToFilename(FOLDERNAME, FOLDERDIR, [EXTENSION])
327
328           Translate a folder name into a filename, using the FOLDERDIR value
329           to replace a leading "=".  If no EXTENSION is specified and this
330           method is called as instance method, new(subfolder_extension) is
331           used.  Otherwise, the extension default to '.d'.
332
333       Mail::Box::Mbox->foundIn([FOLDERNAME], [OPTIONS])
334
335           If no FOLDERNAME is specified, then the value of the "folder"
336           option is taken.  A mbox folder is a file which starts with a sepa‐
337           rator line: a line with 'From ' as first characters.  Blank lines
338           which start the file are ignored, which is not for all MUA's
339           acceptable.
340
341            Option             --Defined in     --Default
342            folder                                undef
343            folderdir            Mail::Box        undef
344            subfolder_extension                   <from object>
345
346           . folder FOLDERNAME
347
348           . folderdir DIRECTORY
349
350           . subfolder_extension STRING
351
352       $obj->lineSeparator([STRING⎪'CR'⎪'LF'⎪'CRLF'])
353
354           See "Internals" in Mail::Box
355
356       $obj->locker
357
358           See "Internals" in Mail::Box
359
360       $obj->messageCreateOptions([TYPE, CONFIG])
361
362           See "Internals" in Mail::Box::File
363
364       $obj->moveAwaySubFolder(DIRECTORY, EXTENSION)
365
366           See "Internals" in Mail::Box::File
367
368       $obj->parser
369
370           See "Internals" in Mail::Box::File
371
372       $obj->read(OPTIONS)
373
374           See "Internals" in Mail::Box
375
376       $obj->readMessages(OPTIONS)
377
378           See "Internals" in Mail::Box
379
380       $obj->storeMessage(MESSAGE)
381
382           See "Internals" in Mail::Box
383
384       $obj->toBeThreaded(MESSAGES)
385
386           See "Internals" in Mail::Box
387
388       $obj->toBeUnthreaded(MESSAGES)
389
390           See "Internals" in Mail::Box
391
392       $obj->updateMessages(OPTIONS)
393
394           See "Internals" in Mail::Box::File
395
396       $obj->write(OPTIONS)
397
398           See "Internals" in Mail::Box::File
399
400       $obj->writeMessages(OPTIONS)
401
402           See "Internals" in Mail::Box
403
404       File based folders
405
406       Other methods
407
408       $obj->timespan2seconds(TIME)
409
410       Mail::Box::Mbox->timespan2seconds(TIME)
411
412           See "Other methods" in Mail::Box
413
414       Error handling
415
416       $obj->AUTOLOAD
417
418           See "Error handling" in Mail::Reporter
419
420       $obj->addReport(OBJECT)
421
422           See "Error handling" in Mail::Reporter
423
424       $obj->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL, CALLBACK])
425
426       Mail::Box::Mbox->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL,
427       CALLBACK])
428
429           See "Error handling" in Mail::Reporter
430
431       $obj->errors
432
433           See "Error handling" in Mail::Reporter
434
435       $obj->log([LEVEL [,STRINGS]])
436
437       Mail::Box::Mbox->log([LEVEL [,STRINGS]])
438
439           See "Error handling" in Mail::Reporter
440
441       $obj->logPriority(LEVEL)
442
443       Mail::Box::Mbox->logPriority(LEVEL)
444
445           See "Error handling" in Mail::Reporter
446
447       $obj->logSettings
448
449           See "Error handling" in Mail::Reporter
450
451       $obj->notImplemented
452
453           See "Error handling" in Mail::Reporter
454
455       $obj->report([LEVEL])
456
457           See "Error handling" in Mail::Reporter
458
459       $obj->reportAll([LEVEL])
460
461           See "Error handling" in Mail::Reporter
462
463       $obj->trace([LEVEL])
464
465           See "Error handling" in Mail::Reporter
466
467       $obj->warnings
468
469           See "Error handling" in Mail::Reporter
470
471       Cleanup
472
473       $obj->DESTROY
474
475           See "Cleanup" in Mail::Box
476
477       $obj->inGlobalDestruction
478
479           See "Cleanup" in Mail::Reporter
480

DETAILS

482       How MBOX folders work
483
484       MBOX folders store many messages in one file.  Each message begins with
485       a line which starts with the string "From ".  Lines inside a message
486       which accidentally start with "From" are, in the file, preceded by `>'.
487       This character is stripped when the message is read.
488
489       In this respect must be noted that the format of the MBOX files is not
490       strictly defined.  The exact content of the separator lines differ
491       between Mail User Agents (MUA's).  Besides, some MUAs (like mutt) for‐
492       get to encode the "From " lines within message bodies, breaking other
493       parsers....
494
495       Simulation of sub-folders
496
497       MBOX folders do not have a sub-folder concept as directory based fold‐
498       ers do, but this MBOX module tries to simulate them.  In this implemen‐
499       tation a directory like
500
501        Mail/subject1/
502
503       is taken as an empty folder "Mail/subject1", with the folders in that
504       directory as sub-folders for it.  You may also use
505
506        Mail/subject1
507        Mail/subject1.d/
508
509       where "Mail/subject1" is the folder, and the folders in the "Mail/sub‐
510       ject1.d" directory are used as sub-folders.  If your situation is simi‐
511       lar to the first example and you want to put messages in that empty
512       folder, the directory is automatically (and transparently) renamed, so
513       that the second situation is reached.
514

DIAGNOSTICS

516       Error: Cannot append messages to folder file $filename: $!
517
518       Appending messages to a not-opened file-organized folder may fail when
519       the operating system does not allow write access to the file at hand.
520
521       Error: Cannot move away sub-folder $dir
522
523       Warning: Cannot remove folder $name file $filename: $!
524
525       Writing an empty folder will usually cause that folder to be removed,
526       which fails for the indicated reason.  new(remove_when_empty)
527
528       Warning: Cannot remove folder $name file $filename: $!
529
530       Writing an empty folder will usually cause that folder to be removed,
531       which fails for the indicated reason.  new(remove_when_empty) controls
532       whether the empty folder will removed; setting it to false (0) may be
533       needed to avoid this message.
534
535       Error: Cannot replace $filename by $tempname, to update folder $name:
536       $!
537
538       The replace policy wrote a new folder file to update the existing, but
539       was unable to give the final touch: replacing the old version of the
540       folder file for the indicated reason.
541
542       Warning: Changes not written to read-only folder $self.
543
544       You have opened the folder read-only --which is the default set by
545       new(access)--, made modifications, and now want to close it.  Set
546       close(force) if you want to overrule the access mode, or close the
547       folder with close(write) set to "NEVER".
548
549       Error: Copying failed for one message.
550
551       For some reason, for instance disc full, removed by external process,
552       or read-protection, it is impossible to copy one of the messages.
553       Copying will proceed for the other messages.
554
555       Error: Destination folder $name is not writable.
556
557       The folder where the messages are copied to is not opened with write
558       access (see new(access)).  This has no relation with write permission
559       to the folder which is controled by your operating system.
560
561       Warning: Different messages with id $msgid
562
563       The message id is discovered more than once within the same folder, but
564       the content of the message seems to be different.  This should not be
565       possible: each message must be unique.
566
567       Error: File too short to get write message $nr ($size, $need)
568
569       Mail::Box is lazy: it tries to leave messages in the folders until they
570       are used, which saves time and memory usage.  When this message
571       appears, something is terribly wrong: some lazy message are needed for
572       updating the folder, but they cannot be retreived from the original
573       file anymore.  In this case, messages can be lost.
574
575       This message does appear regularly on Windows systems when using the
576       'replace' write policy.  Please help to find the cause, probably some‐
577       thing to do with Windows incorrectly handling multiple filehandles open
578       in the same file.
579
580       Error: Folder $name not deleted: not writable.
581
582       The folder must be opened with write access via new(access), otherwise
583       removing it will be refused.  So, you may have write-access according
584       to the operating system, but that will not automatically mean that this
585       "delete" method permits you to.  The reverse remark is valid as well.
586
587       Error: Invalid timespan '$timespan' specified.
588
589       The string does not follow the strict rules of the time span syntax
590       which is permitted as parameter.
591
592       Warning: Message-id '$msgid' does not contain a domain.
593
594       According to the RFCs, message-ids need to contain a unique random
595       part, then an "@", and then a domain name.  This is made to avoid the
596       creation of two messages with the same id.  The warning emerges when
597       the "@" is missing from the string.
598
599       Error: Package $package does not implement $method.
600
601       Fatal error: the specific package (or one of its superclasses) does not
602       implement this method where it should. This message means that some
603       other related classes do implement this method however the class at
604       hand does not.  Probably you should investigate this and probably
605       inform the author of the package.
606
607       Error: Unable to create subfolder $name of $folder.
608
609       The copy includes the subfolders, but for some reason it was not possi‐
610       ble to copy one of these.  Copying will proceed for all other sub-fold‐
611       ers.
612
613       Error: Unable to update folder $self.
614
615       When a folder is to be written, both replace and inplace write policies
616       are tried,  If both fail, the whole update fails.  You may see other,
617       related, error messages to indicate the real problem.
618

SEE ALSO

620       This module is part of Mail-Box distribution version 2.070, built on
621       March 25, 2007. Website: http://perl.overmeer.net/mailbox/
622

LICENSE

624       Copyrights 2001-2007 by Mark Overmeer.For other contributors see
625       ChangeLog.
626
627       This program is free software; you can redistribute it and/or modify it
628       under the same terms as Perl itself.  See
629       http://www.perl.com/perl/misc/Artistic.html
630
631
632
633perl v5.8.8                       2007-03-25                Mail::Box::Mbox(3)
Impressum