Mail_Box RFC (?)
| From: | Wolfram Kriesing | Date: | Tue, 15 Jul 2003 11:27:38 +0000 |
| Subject: | Mail_Box RFC (?) | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-18250@lists.php.net to get a copy of this message | ||
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