如题。
解决方案 »
- 请教spring整合freemarker的问题?
- 请问若无特殊需求,在JAVA编程时,在静态方法和普通方法的选择中,是不是尽量使用静态方法,代码执行的效率会高点,系统性能会好点,还是使用普通方法即可。多谢。
- 一张大图片里面包涵很多小图片,这叫什么来着?
- 用myelipse 创建web project J2EE5.0怎么样使用C标签
- 急 hibernate 注解 自己对自己的一对一配置
- 关于邮件群发的问题【请您放下脚步进来指教一二,谢谢!】
- springMVC中同一个controller如何处理不同请求?
- 关于java读取txt文件的问题? 高手指教.........
- servlet 问题。(1)重定向。(2)tomcat4.1.2问题。
- 请问:哪里有现成的将word转换成txt文件的api
- jsp中关于图片的问题
- 那个 sun官网的api 怎么下啊
Properties props = new Properties();
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "smtp.163.com");
Session session = Session.getInstance(props,
new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication("username","pwd");//填"用户名","密码"
}
}
);
session.setDebug(true);Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("[email protected]"));//填发送人email地址
msg.setSubject("subject");//填email标题
msg.setRecipients(RecipientType.TO,
InternetAddress.parse("[email protected]"));//接收人email地址
msg.setContent("content");//email正文Transport.send(msg);
}对应位置填你的email地址,用户名,密码等信息。一个简单的发送email的代码了,项目里要加入mail.jar
jar包通过这个地址下载
http://www.oracle.com/technetwork/java/javamail/index-138643.html
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
at javax.mail.Session.loadProvidersFromStream(Session.java:928)
at javax.mail.Session.access$000(Session.java:174)
at javax.mail.Session$1.load(Session.java:870)
at javax.mail.Session.loadResource(Session.java:1084)
at javax.mail.Session.loadProviders(Session.java:889)
at javax.mail.Session.<init>(Session.java:210)
at javax.mail.Session.getInstance(Session.java:232)
at org.test.youjian.Test.main(Test.java:144)什么类没编译。 架包都导过了