日期:2014-05-18  浏览次数:20621 次

简单邮件程序出错:
程序如下:
String   host   =   "smtp.sina.com ";
String   to   =   request.getParameter( "to ");
String   from   =   request.getParameter( "from ");
String   subject   =   request.getParameter( "subject ");
String   messageText   =   request.getParameter( "body ");
boolean   sessionDebug   =   false;

Properties   props   =   System.getProperties();
props.put( "mail.host ",   host);
props.put( "mail.transport.protocol ",   "smtp ");

//props.put( "mail.smtp.host ",   host);
//props.put( "mail.smtp.auth ",   "false ");

Session   mailSession   =   Session.getDefaultInstance(props,   null);

mailSession.setDebug(sessionDebug);

Message   msg   =   new   MimeMessage(mailSession);

msg.setFrom(new   InternetAddress(from));
InternetAddress[]   address   =   {new   InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO,   address);
msg.setSubject(subject);
msg.setSentDate(new   Date());
msg.setText(messageText);

这个处理程序我是写jsp页中的,出现了以下的错误:javax.mail.SendFailedException:   Sending   failed;
    nested   exception   is:  
javax.mail.MessagingException:   553   Requested   action   not   taken:   Local   user   only,smtp5,wKjRELCLipyUCApGW3sXBA==.25369S2   1175062676


我都搞了快有两天时间了,一个这样简单的程序还没搞定.请各位高手帮我解释一下.


------解决方案--------------------
jsp和非jsp中发的代码都有,
http://community.csdn.net/Expert/TopicView3.asp?id=5424684