1。服務系統不需要驗證發件人的授權的
????Session?session?=?Session.getDefaultInstance(props,?null);?
2。要驗證發件人的授權
????props.put("mail.smtp.auth",?"true");?
????MyAuthenticator?myauth?=?new?MyAuthenticator("你自己的電子信箱",?"你自己的信箱密碼");
????Session?session?=?Session.getDefaultInstance(props,?myauth);
3。同時發送多封電子郵件
Transport.send(message);可以使用下面的代碼來代替
??????String?username?=?"你的電子信箱用戶名";
??????String?password?=?"你的電子信箱密碼";
??????message.saveChanges();?//????implicit?with?send()
??????Transport?transport?=?session.getTransport("smtp");
??????transport.connect("mail.htf.com.cn",?username,?password);
??????transport.sendMessage(message,?message.getAllRecipients());
??????transport.close();
Communication Component,溫習。
http://www.china1024.com/news_content.jsp?news_id=1060