摘要:
//该程序用来接受带有html信息的邮件
void jbutton7_actionperformed(actionevent e) {
try
{
properties props = system.getproperties();
authenticator auth = new email_autherticator();
props.put("mail......
摘要:
本文内的 jsp 程序都是按功能自己成立一个独立的程序,大家要使用什么功能,自己组合吧。
文件的建立/检查与删除
<%@ page contenttype="text/html;charset=gb2312"%><%@ page import="java.io.*"%><html><head><tit......
JavaMail操作的总结(2)
//此段代码用来进行服务器对用户的认证
{
【程序编程相关:
新事务之一:dotNET和COM+中的事】public class email_autherticator extends authenticator
【推荐阅读:
体验Microsoft.NET--与初学】{
【扩展信息:
在.NET中的线程处理(6)】public email_autherticator()
super();
}
public passwordauthentication getpasswordauthentication()
{
return new passwordauthentication(username,password);
}
}
//该程序为接收邮件
void jbutton2_actionperformed(actionevent e) {
try
{
properties props = system.getproperties(); //获取系统变量
authenticator auth = new email_autherticator();
props.put("mail.smtp.host",host);
props.put("mail.smtp.auth","true");
session session = session.getdefaultinstance(props,auth); //建立session
store store = session.getstore("pop3");
store.connect(host,username,password);
//after connecting to the store,you can get a folder,which must be opened before you can read messages from it:
folder folder = store.getfolder("inbox");//连接到store后,取得一个文件夹,一般默认的是index
folder.open(folder.read_write);//read_only为打开方式
message message[] = folder.getmessages();//从文件夹获取邮件信息
//可以用两种方式去获得邮件信息,getcontent()用来获得邮件的主体信息....
下一页 摘要:
摘要 这篇文章介绍创建基于java的email应用程序入门知识。假如你想创建你自己的email客户端应用程序来代替microsoft outlook,或者创建一个基于web的email系统来跟hotmail叫板,那么你可以从这里开始。从javamail的一个不同角度出发,该文给出了一个谈话email客户端应用程序。 在javamail中,你可以找到api以及其实现部分,从而......