Re: Mail_Box RFC (?)

From: Date: Tue, 15 Jul 2003 12:32:27 +0000
Subject: Re: Mail_Box RFC (?)
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18255@lists.php.net to get a copy of this message
I actually posted a message about this a while ago, that some common packages should follow the same api and if not possible to implement a function should return a not supported error. for example instead of making one class which has different subclasses, you cold have classes which follow the same api (implement an interface if you will), in that way you would not not need to care whether it is a Net_POP3 class NET_IMAP class or a NET_MBOX class or even a NET_Maildir (I wish :O) class. this should be applied to many places in pear cache (almost the same but not quite cahce and cache_lite) email handling (Net_POP3,NET_IMAP,NET_MBOX,NET_Maildir ) although it has become the defacto standard in pear to use base class/container objects, in some cases this causes just more overhead. Of course this is now what you were talking about, if I recall you were talking about using the imap extension to do this, i personally have found it buggy altough poeple say it has improved latelly. any way I try to push my ideas even when it is irrelevant. :) Yavor ----- Original Message ----- From: "Wolfram Kriesing" <wolfram@visionp.de> To: <pear-dev@lists.php.net> Sent: Tuesday, July 15, 2003 2:27 PM Subject: [PEAR-DEV] Mail_Box RFC (?) > 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 > >

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