作者:empty 出版社:empty |
Instructions on howto download and install the JavaMail APl are contained in the course.Inaddition, you will need a development environment such as the JDK 1.1.6+or the Java 2Platform, Standard Edtion(J2SE) 1.2.x or 1.3.xA general familiarity wth object-oriented programming concepts and the Java programminglanguage is necessary.The Java language essentials tutorial can help.copyright 1996-2000Magelang Institute dba jGuruContactjGuru has been dedicated to promoting the growth of the Java technology communitythrough evangelism, education, and software since 1995.You can find out more abouttheir activities,includingtheirhugecollectionofFAQsatjGuru.com, To send feedbackto jGuru about this course,sendmailtoproducen@iguru.com,Course author:Formerly with jGuru.com, John Zukowski does strategic Javaconsulting for JZ Ventures, Inc.His latest book is titled Java Collections from A press.Fundamentals of the JavaMail APIPage 2
The JavaMail APl is an optional package(standard extension) for reading, composing, andsending electronic messages.You use the package to create Mail UserAgent(MUA) typeprograms, similar to Eudora, pine, and Microsoft Outlook.The API's main purpose is not fortranspo ring.delivering, and forwarding messages; this is the purview of applications such assendmail and other Mail Transfer Agent(MTA) type programs.MUA-type programs let usersread and write e-mail, whereas MUAs relyon MTAs to handle the actual delivery.The JavaMail APl is designed to provide protoco-independent access for sending andreceiving messages by dividing the APlin to two parts:Fundamentals of the JavaMail APIPage 3Presented by developerWorks, your source for great tutorialsibm.com/developerWorksThe first part of the APl is the focus of this course-basically, howto send and receivemessages independent of the provider/protocol.The second part speaks the protocol-specific languages, like SMTP, POP, IMAP, andNNTP.With the JavaMail API, in order to communicate with a server, you need aprovider for a protocol.The creation of protocol-specific providers is not covered in thiscourse because Sun provides a sufficient set for freeSection 3.Reviewing related protocols
IntroductionBefore looking into the JavaMail API specifics, let's step back and take a look at the protocolsused with the API.There are basically four that you'l come to know and love:You will also run across NNTP and some others.Understanding the basics of all theprotocols will help you understand howto use the JavaMail API.While the APl is designed tobe protocol agnostic, you can't overcome the limitations of the underlying protocols.If acapability is n't supported by a chosen protocol, the JavaMail API doesn't magically add the
The Simple Mail Transfer Protocol(SMTP) isdefinedby RFC 821.It defines the mechanismfor delivery of e-mail.In the context of the JavaMail APl, your JavaMail-based program wilcommunicate with your company or Internet Service Provider's(ISP's) SMTP server.ThatSMTP server wil relay the message on to the SMTP server of the recipients) to eventuallybe acquired by the user(s) through POP or IMAP.This does not require your SMTP server tobean open relay, as authentication is supported, but it is your responsiblity to ensure theSMTP server is configured properly.There is nothing in the JavaMail APl for tasks likeconfiguring a server to relay messages or to add and remove e-mail accounts.
POP stands for Post Offce Protocol.Currently in version 3, also known as POP 3, RFC 1939defines this protocol.POP is the mechanism most people on the Internet use to get theirmail.It defines support for a single mailbox for each user.That is all it does, and that is alsothe source of alot of confusion.Much of what people are familiar with when using POP, likethe ability to see how many new mail messages they have, are not supported by POP at allThese cap abl ities a rebuit into programs like Eudora or Microsoft Outlook, which rememberthings like the last mail received and calculate how many are new for you.So, when usingthe JavaMail API, if you want this type of information.you have to calculate it yourself.IMAPIMAP is a more advanced protocol for receiving messages.Defined in RFC 2060, IMAPstands for Inte met Message Access Protocol, and is currently in version 4, also known asIMAP 4.When using IMAP, your mailserver must support the protocol.You can't just changeyour program to use IMAP instead of POP and expect everything in IMAP to be supported.Assuming your mailserver supports IMAP, your Java Mai-based program can takeFundamentals of the JavaMail APIPage 4