一般用session.getInstance(properties,Authenticator)
解决方案 »
- java中怎么获取客户端的真实的IP
- 我下载的是最新的struts2 2.2.3 ,但是docs里只有三个,没有api,在myeclipse里面想查看本地的api帮助。
- could not initialize proxy - no Session
- 关于weblogic8.1的日志
- 紧急求助!!!WSWS3192E: 错误:WebServicesFault 的映射异常。 <(404)Not Found>WebServicesFault
- struts中数据原问题??
- 用 spring 的优点和缺点
- 急,POI的问题,不知道为什么会这样啊,怎么出现java.lang.NoClassDefFoundError: org/apache/log4j/Category
- There is no Action mapped for namespace [/] and action name [] associated with c
- 关于hibernate的问题
- 为什么ajax没有出现跨域问题
- 关于sql server jdbc驱动的问题!!
可另一种Transport.connect(smtpHost,user,password)看起来也不是不可以啊。
mimeMsg.setContent(mp);
mimeMsg.saveChanges();
Session mailSession = Session.getInstance(props,null);//1
Transport transport = mailSession.getTransport("smtp");
transport.connect((String)props.get("mail.smtp.host"),mailuser,mailpassword);//2
transport.sendMessage(mimeMsg,mimeMsg.getAllRecipients());
if (sendlog!=null)
sendlog.println("Mail Successfully Sended!");
transport.close();
}
catch(Exception e)
{
if (sendlog!=null)
sendlog.println(e.getMessage());;
return false ;
}