java 收邮件 使用 mail包
import java.util.Properties;
import javax.mail.FetchProfile;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Store;
import javax.mail.internet.InternetAddress;
public class ReceiveMail
{
public ReceiveMail(){}
public static void main(String[] args)
{
receive();
}
public static void receive()
{
try
{
Properties props = new Properties();
Session s = Session.getInstance(props);
Store store = s.getStore("pop3");
//对应改成自己的用户名和密码
store.connect("pop.sina.com", "userName", "******");
Folder folder = store.getFolder("Inbox");
folder.open(Folder.READ_WRITE);
FetchProfile profile = new FetchProfile();
profile.add(FetchProfile.Item.ENVELOPE);
Message arraymessage[] = folder.getMessages();
folder.fetch(arraymessage, profile);
System.out.println("收件箱的邮件数:" + arraymessage.length);
for (int i = 0; i < arraymessage.length; i++)
{
//邮件发送者
String from = arraymessage[i].getfrom()[0].toString();
InternetAddress ia = new InternetAddress(from);
System.out.println("******" + i + "******");
System.out.println("from:" + ia.getPersonal() + '(' + ia.getAddress() + ')');
//邮件标题
System.out.println("Title:" + arraymessage[i].getSubject());
//邮件大小
System.out.println("Size:" + arraymessage[i].getSize(
相关文档:
代理服务器的应用非常广泛。比如,在企业网内部,它可以用来控制员工在工作时浏览的Internet内容,阻止员工访问某些类型
的内容或某些指定的网站。代理服务器实际上扮演着浏览器和Web服务器之间的中间人的角色,能够对浏览器请求进行各种各样的处理,能够过滤广告和
Cookie,能够预先提取Web页面,使得浏览器访问 ......
工作需要,针对java文件,作了一个行数统计的工具。统计的主要代码如下:
Set srcIn = fso.OpenTextFile(fileNm, ForReading)
Do While Not srcIn.AtEndOfStream
buf = srcIn.ReadLine
&nbs ......
中文的编码常用的有3种格式:1)gb2312(就是ascii码方式,也说ansi) 2)unicode 3)utf-8
c++一般采用ancii码,而java一般采用unicode,而SymbianC++(以后简称symbian)采用unicode或utf-8
比如汉字“好”: unicode为“7D 59”,而ascii为“BA C3”, utf-8编码为3个字节。
终端你 ......
深入理解java多态性
昨天看到一个关于多态性的帖子,参考了回帖者的理解,加入了一些自己的看法,整理出来供大家参考,不一定 ......
最近学了servlet和oracle,也就把他们结合下,做个分页的页面出来。算是一种复习吧。
1.首先是oracle的分页显示SQL语句:
select * from(select a.*, rownum rn from (select * from Person) a where rownum <= MaxN ......