Java邮件发送开发库,Apache Commons Email 1.3.3 发布
jopen 10年前
Apache Commons Email 1.3.3 发布了, Commons Email 的目的是提供一个API来发送电子邮件。它是建立在Java Mail API 之上,旨在简化使用。
它提供的一些主要类如下:
- SimpleEmail - 这个类是用来发送基本的基于文本的电子邮件。
- MultiPartEmail - This class is used to send multipart messages. This allows a text message with attachments either inline or attached.
- HtmlEmail - This class is used to send HTML formatted emails. It has all of the capabilities as MultiPartEmail allowing attachments to be easily added. It also supports embedded images.
- ImageHtmlEmail - This class is used to send HTML formatted emails with inline images. It has all of the capabilities as HtmlEmail but transform all image references to inline images.
- EmailAttachment - This is a simple container class to allow for easy handling of attachments. It is for use with instances of MultiPartEmail and HtmlEmail.
Email email = new SimpleEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setSSLOnConnect(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com"); email.send();
该版本在 1.3.2 的基础上改进如下:
== 兼容性== * Java 5 或更高版本(从1.3不变)。 == Bugs 修复== * 附件的文件名包含了非ASCII字符,编码会不正确的情况。 Issue: EMAIL-138. Thanks to qed. * MimeMessageParser没有正确解析由 HtmlEmail.buildMimeMessage()和HtmlEmail.getMimeMessage()所创造的MimeMessage对象 Issue: EMAIL-137. Thanks to Alex Kogan. * Fix Javadoc 1.8 errors. Issue: EMAIL-136. Thanks to Ville Skyttä.下载:http://commons.apache.org/proper/commons-email/