Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Java EE 综合讨论区
打印话题 寄给朋友 订阅主题 |
作者 | 求教:java Mail程序报错 |
pc
发贴: 15 积分: 0 |
于 2005-01-26 18:53
public void sendmail() throws Exception{ Session session; MimeMessage message; from = "sz_reqly@163.com"; smtpHost = "smtp.163.com"; to = "sz_reqly@163.com"; pwd = "12345"; subject = "subject"; comment = "comment"; System.out.println(smtpHost); System.out.println(id); System.out.println(from); System.out.println(to); Properties props = System.getProperties(); props.put("mail.smtp.host",smtpHost); session = Session.getInstance(props,null); message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.setRecipient(Message.RecipientType.TO,new InternetAddress(to)); message.setSubject(subject); message.setText(comment); message.setSentDate(new java.util.Date()); Transport transport = session.getTransport("smtp"); transport.connect(smtpHost,id,pwd); transport.send(message); }//send mail 错误如下: nested exception is: javax.mail.MessagingException: 553 You are not authorized to send mail as >, authentication is required org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800) org.apache.jsp.Internet.email_jsp._jspService(email_jsp.java:76) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) root cause javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: 553 You are not authorized to send mail as >, authentication is required javax.mail.Transport.send0(Transport.java:219) javax.mail.Transport.send(Transport.java:81) pc.Examples.Servlet.internet.EmailSender.sendmail(EmailSender.java:107) org.apache.jsp.Internet.email_jsp._jspService(email_jsp.java:62) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 一个程序员的奋斗历程 |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
4397 | 求教:java Mail程序报错 | pc | 2611 | 2005-01-26 18:53 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |