Mail::Folder::Emaul - An Emaul folder interface for Mail::Folder.
WARNING: This code is in alpha release. Expect the interface to change.
use Mail::Folder::Emaul;
This module provides an interface to the emaul folder mechanism. It is currently intended to be used as an example of hooking a folder interface into Mail::Folder.
The folder structure of Emaul is styled after mh. It uses directories for folders and numerically-named files for the individual mail messages. The current message for a particular folder is stored in a file .current_msg in the folder directory.
.current_msg
Folder locking is accomplished through the use of a .lock file in the folder directory.
If a Timeout option is specified when the object is created, that value will be used to determine the timeout for attempting to aquire a folder lock. The default is 10 seconds.
Timeout
Populates the Mail::Folder object with information about the folder.
Mail::Folder
Call the superclass open method.
open
Make sure it is a valid mbox folder.
Check to see it it is readonly
Lock the folder if it is not readonly. (This is dubious)
For every message file in the $folder_name directory, add the message_number to the list of messages in the object.
$folder_name
Load the contents of $folder_dir/.current_msg into $self->{Current}.
$folder_dir/.current_msg
$self->{Current}
Set current_message.
current_message
Load message labels.
Unlock the folder if it is not readonly.
Flushes any pending changes out to the original folder.
Call the superclass sync method.
sync
Return -1 if the folder is readonly.
-1
Return -1 if the folder cannot be locked.
Scan the folder directory for message files that were not present the last time the folder was either opened or synced and absorb them.
For every pending delete, unlink that file in the folder directory
Clear out the 'pending delete' list.
Update the .current_msg file and the .msg_labels file if the NotMUA option is not set.
.msg_labels
NotMUA
Return the number of new messages found.
Calls the superclass pack method.
pack
Return 0 if the folder is readonly.
0
Return 0 if the folder cannot be locked.
Renames the message files in the folder so that there are no gaps in the numbering sequence. It will tweak current_message accordingly.
Old deleted message files (ones that start with ,) are also renamed as necessary.
,
It will abandon the operation and return 0 if a rename fails, otherwise it returns 1.
rename
1
Please note that pack acts on the real folder.
Calls the superclass get_message method.
get_message
Retrieves the given mail message file into a Mail::Internet object reference and returns the reference.
It will coerce the From_ field into a Mail-From field, add the 'seen' label to the message, remove the Content-Length field if present, and cache the header.
From_
Mail-From
seen
Content-Length
Returns undef on failure.
undef
Calls the superclass get_message_file method.
get_message_file
Retrieves the given mail message file and returns the name of the file.
Calls the superclass get_header method.
get_header
If the particular header has never been retrieved then get_header loads the header of the given mail message into a member of $self->{Messages}{$msg_number} and returns the object reference
$self->{Messages}{$msg_number}
If the header for the given mail message has already been retrieved in a prior call to get_header, then the cached entry is returned.
The Content-Length field is deleted from the header object it returns.
Calls the superclass append_message method.
append_message
Returns 0 if it cannot lock the folder.
Appends the contents of the mail message contained $mref to the the folder.
$mref
It also caches the header.
Please note that, contrary to other documentation for Mail::Folder, the Emaul append_message method actually updates the real folder, rather than queueing it up for a subsequent sync. The dup and refile methods are also affected. This will be fixed soon.
dup
refile
Calls the superclass update_message method.
update_message
It returns 0 if it cannot lock the folder.
Replaces the message pointed to by $msg_number with the contents of the Mail::Internet object reference $mref.
$msg_number
Mail::Internet
Please note that, contrary to other documentation for Mail::Folder, the Emaul update_message method actually updates the real folder, rather than queueing it up for a subsequent sync. This will be fixed soon.
Returns 0 if the folder is not a directory or looks like a maildir folder. The current logic allows it to handle MH directories, but watch out; you should probably set the NotMUA option so the interface doesn't create it's own little folder droppings like .msg_labels and such.
Returns 0 if the folder already exists.
Creates a new folder named $foldername with mode 0700 and then returns 1.
$foldername
0700
Kevin Johnson <kjj@pobox.com>
Copyright (c) 1996-1998 Kevin Johnson <kjj@pobox.com>.
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mail::Folder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::Folder
CPAN shell
perl -MCPAN -e shell install Mail::Folder
For more information on module installation, please visit the detailed CPAN module installation guide.