十二 12 2008

利用Commons Email发送文本邮件

Commons Email aims to provide a API for sending email. It is built on top of the Java Mail API, which it aims to simplify.

1
2
3
4
5
6
7
8
9
10
11
		SimpleEmail email=new SimpleEmail();
		email.setHostName("smtp.163.com");//设置smpt服务器
		email.setFrom("yava555@163.com", "yava");
		email.setAuthentication("yava555@163.com", "******");//用户名和密码
 
		email.addTo("yava555@gmail.com","yava");//要发送邮箱
 
		email.setSubject("测试");
		email.setCharset("gb2312");//设置编码,必须在setMsg()之前
		email.setMsg("哈哈,测试一下:)");
		email.send();

Commons-Email构建在JavaMail基础之上,因此必须将JavaMail-API加入到环境变量中。
Commons Email:http://commons.apache.org/email/


十一 26 2008

Commons FileUpload介绍

Commons FileUpload是Apache commons下面的一个子项目,用来实现Java环境下面的文件上传功能,与常见的SmartUpload齐名。
因为最近做的一个项目要实现JSP文件上传功能,在这里先研究一下,网上有很多关于FileUpload的文章。

Commons FileUpload官网:http://commons.apache.org/fileupload/