`
qjoycn
  • 浏览: 1216080 次
文章分类
社区版块
存档分类
最新评论

Mail开源库JavaMail

 
阅读更多

对于使用Mail库,最著名的是Sun公司的JavaMail。详细内容参见官方网站:http://java.sun.com/products/javamail/index.jsp

下面是官方网站对于JavaMail的主要描述:The JavaMail API provides a platform-independent and protocol-independent framework to build mail and messaging applications. The JavaMail API is available as an optional package for use with Java SE platform and is also included in the Java EE platform.

从官方描述来看,JavaMail可以用于Java SE平台和Java EE平台。

下面是一些从官方FAQ摘录出来的几条有用的信息。

Q: What is the JavaMail API?

A: The JavaMail API is a set of abstract APIs that model a mail system. The API provides a platform independent and protocol independent framework to build Java technology based email client applications. The JavaMail API provides facilities for reading and sending email. Service providers implement particular protocols. Several service providers are included with the JavaMail API package; others are available separately. The JavaMail API is implemented as a Java optional package that can be used on JDK 1.4 and later on any operating system. The JavaMail API is also a required part of the Java Platform, Enterprise Edition (Java EE).

Q: How do I get an implementation of the JavaMail API?

A: Sun provides a royalty-free reference implementation, in binary form, that developers may use and ship. The reference implementation includes the core JavaMail packages and IMAP, POP3, and SMTP service providers. The reference implementation may be downloaded here.

Q: What JDK does the JavaMail API need?

A: The JavaMail API requires JDK/JRE 1.4 or higher. The JavaMail API is a Java optional package, it is not part of the core Java SE but is included in Java EE.

下面是来自百度百科的介绍,可能不够准确,但是基本可以看出JavaMail的功能了:

JavaMail,顾名思义,提供给开发者处理电子邮件相关的编程接口。它是Sun发布的用来处理emailAPI。它可以方便地执行一些常用的邮件传输。我们可以基于JavaMail开发出类似于Microsoft Outlook的应用程序。

  虽然JavaMailSunAPI之一,但它目前还没有被加在标准的java开发工具包中(Java Development Kit),这就意味着你在使用前必须另外下载JavaMail文件。除此以外,你还需要有SunJavaBeans Activation Framework JAF)。JavaBeans Activation Framework的运行很复杂,在这里简单的说就是JavaMail的运行必须得依赖于它的支持。在Windows 2000下使用需要指定这些文件的路径,在其它的操作系统上也类似。

JavaMail是可选包,因此如果需要使用的话你需要首先从java.sun.com下载。目前最新版本是JavaMail1.4,使用JavaMail的时候需要Javabean Activation Framework的支持,因此你也需要下载JAF。安装JavaMail只是需要把他们加入到CLASSPATH中去,如果你不想修改CLASSPATH的话,可以直接把他们的jar包直接copyJAVA_HOME/lib/ext下。这样JavaMail就安装好了。

JavaMail支持SmtpPop3Imap协议,但是需要注意的是,它不能直接用于Java ME平台下。但是经过研究,发现可以简单删除部分边缘类,然后就可以在Java ME平台下使用了。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics