Re: Mail_Box RFC (?)

From: Date: Tue, 15 Jul 2003 13:23:31 +0000
Subject: Re: Mail_Box RFC (?)
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18258@lists.php.net to get a copy of this message
it seems there is some agreement that something like this is needed. now it would be interesting to agree on the class-structure and the method names. opinions or +/-1's very welcome :-) Jan Schneider wrote:
I had almost the identical idea after the discussion about putting Net_Cyrus into PEAR and some duplicate stuff between Net_IMAP and Net_Cyrus. What I wanted to do was to split Net_IMAP up to Net_IMAP_Lite that only implements stuff that's missing in the the imap extension, and Net_IMAP that extends Net_IMAP_Lite and implements also the stuff from the extension. Code from Net_Cyrus that's still missing in these three parts will be merged into Net_IMAP_Lite. A third class (no name yet) would wrap around theses two classes and the extension as a factory, loads only that classes that are necessary and provides a single API to all IMAP/POP3 functions. The benefit would be that you don't have to load that huge Net_IMAP class if you already have the imap extension present but still can use all of the IMAP functions if you don't have the extension available. Programs that depend on the extension anyway (like IMP) would only use Net_IMAP_Lite to "complete" their IMAP api. This is very similar to what you want to do and adding support for direct mailbox access too sounds reasonable to me. Unfortunately I have too few time at the moment to work on it but perhaps we can agree on one set of APIs. Zitat von Wolfram Kriesing <wolfram@visionp.de>:
i was searching the PEAR repository and didnt find an appropriate package, that i could use to get mails (from a server), either via POP, IMAP, Mbox ... There are different packages with different API's, Net_POP3, Net_IMAP, Mail_Mbox, etc. All the Net_* classes do (as expected) implement the protocol themselves, but there is no wrapper around the imap-extension functions, which fortunately can also handle the POP3 protocol, so here is my suggestion for a unified mail-retreiving interface (kinda like [M]DB are abstractions for different DB's). If i have just missed the package, that already does that, please tell me and toss this mail :-) Since the API of Net_IMAP seems best suited I will use most method names from there. The biggest diff might be that I would suggest to seperate the functionality into 3 classes/packages as follows. I will try to define the method names, in order to try to establish common method names. Mail_Box ----------- This class will handle a mail box, it offers methods to retreive information about the mail box, such as the number of messages, the complete size, etc. Suggested methods: * connect( $host, $port) * disconnect( $expungeOnExit) * login( $user, $pass, $useauthenticate) * selectMailbox($mailbox) Only relevant for IMAP * getSize() The size in [k]B of the entire mailbox content * getMessageList() * getNumberOfMessages() * getMessage($msgId) Return a Mail_[Box_]Message object for the message with the given ID * removeMessage($msgId) * search(???) Methods such as createMailbox() etc. should be defined when someone wants to write the Modifier methods/class for this, currently I only defined a Reader/Explorer. Mail_[Box_]Message ------------------- This class can be used to explore, and may be at a later stage also to build a message (so that the mail class(es) could also simply use this interface to build their messages). * getRawHeaders() * getParsedHeaders() * getSubject() * getBody() * getFrom() * getTo() * getReplyTo() * getHeader($header) Returns a certain header, like 'From' or 'Subject' ... * getSize() * getSendDate() * hasAttachment() * getNumberOfAttachments() * getAttachmentList() Lists a summary of the attachments, such as filenames size etc. and the ID by which you can refer to an attachment * getAttachment($attId) Returns a Mail_[Box_]Attachment object, that one can use to explore the attachment only IMAP relevant methods * getFlags() * isSeen() * isDraft() * is Answered() * isFlagged() * isDeleted() Mail_[Box_]Attachment ---------------------- This class can be used to explore a single attachment, may be at a later stage also to build an attachment which might be added to a message. * getData() * getMimetype() * getFilename() * getSize() Every input is welcome. Are the package names ok? Since I currently only need POP3, but later also the reteiving of raw messages i will only have the time to implement those pieces, it would be great if someone with some more knowhow of the entire mail stuff could support me or even take over the task ... -- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... authentication system .... http://sf.net/projects/auth -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Jan. -- http://www.horde.org - The Horde Project http://www.ammma.de - discover your knowledge http://www.tip4all.de - Deine private Tippgemeinschaft
-- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... authentication system .... http://sf.net/projects/auth

« previous php.pear.dev (#18258) next »