初学者所碰到的javamail问题~~~~~~~~
我超了段代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.lang.*" errorPage="" %>
<%@ page import="javax.mail.*,javax.mail.internet.*,javax.activation.*,java.util.*"%>
<html>
<head>
<TITLE>
JSP meets JavaMail, what a sweet combo.</TITLE>
</head><body>
<%
try{
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;
sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "smtp.163.com");
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress(request.getParameter("from")));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(request.getParameter ("to")));
newMessage.setSubject(request.getParameter("subject"));
newMessage.setSentDate(new java.util.Date());
newMessage.setText(request.getParameter("text"));
transport = sendMailSession.getTransport("smtp");
store = sendMailSession.getStore("pop3");
store.connect("pop3.163.com","用户名","密码");
Transport.send(newMessage);
store.close();
%>
<P>Your mail has been sent.</P>
<%
}catch(MessagingException m)
{
out.println(m.toString());
}
%></body></html>
运行的时候出现如下错误提示:
javax.mail.SendFailedException: Sending failed; nested exception is: class javax.mail.MessagingException: 553 You are not authorized to send mail as >, authentication is required
请为各为大虾如何解决!