手机版
你好,游客 登录 注册
背景:
阅读新闻

Commons Email 1.3.2 发布,Java 邮件开发包

[日期:2013-10-26] 来源:oschina.net  作者:Linux [字体:大 中 小]

Commons Email 1.3.2 发布了,该项目是Apache的Commons子项目下的一个邮件客户端组件,它是基于JavaMail的,大大简化了邮件的收发操作。

该版本改进记录包括:

  • Change visibility of DataSourceUrlResourceResolver.createUrl(String) to protected so that sub-classes can override it. Fixes EMAIL-135.
  • Support default mime charset property "mail.mime.charset" when adding text content to instances of either SimpleEmail or HtmlEmail. Fixes EMAIL-104
  • Added support for sending partial emails in case of invalid addresses. Fixes EMAIL-132. Thanks to Allen Xudong Cheng.
  • The MimeMessageParser will now correctly parse MIME multi-parts of type "text/plain" and "text/html" with a content disposition header of "attachment". The parts will be added to the list of attachments even if there is no other text or html content. Fixes EMAIL-131.
  • Special characters in the body of an HTML email could lead to an exception when the mime message was built. Fixes EMAIL-127. Thanks to Dominik Stadler.

示例代码:

01 Email email = new SimpleEmail();
02 email.setHostName("smtp.googlemail.com");
03 email.setSmtpPort(465);
04 email.setAuthenticator(new DefaultAuthenticator("username", "password"));
05 email.setSSLOnConnect(true);
06 email.setFrom("user@gmail.com");
07 email.setSubject("TestMail");
08 email.setMsg("This is a test mail ... :-)");
09 email.addTo("foo@bar.com");
10 email.send();

JavaDoc: http://commons.apache.org/email/apidocs/index.html

Commons Email 的下载地址:请点这里

linux
相关资讯       Commons Email 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款