用javamail写了一个发送邮件的程序,但是发送后提示404错误,不知道怎么回事。向高手请教。
    页面代码:
<%@ page language="java" contentType="text/html; charset=gb2312"
 pageEncoding="gb2312"%>
<%@ page import="javax.activation.*"%>
<%@ page import="javax.mail.internet.*"%>
<%@ page import="java.util.*"%>
<%@ page import="javax.mail.*"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%
    class MyAuthenticator
      extends javax.mail.Authenticator {
    private String strUser;
    private String strPwd;
    public MyAuthenticator(String user, String password) {
      this.strUser = user;
      this.strPwd = password;
    }    protected PasswordAuthentication getPasswordAuthentication() {
      return new PasswordAuthentication(strUser, strPwd);
    }
  }
%> <%    
 
   String subject = request.getParameter("title");
   String subtext = request.getParameter("content");
   
   if(subject!=null && !subject.equals("") && subtext!=null && !subtext.equals(""))
   {
   try {    Properties props = new Properties();
    props.put("mail.smtp.host", "smtp.163.com");
    props.put("mail.smtp.auth","true");

MyAuthenticator myauth = new MyAuthenticator("username", "password");
Session sessions = Session.getDefaultInstance(props, myauth);    MimeMessage newMessage = new MimeMessage(sessions);
    newMessage.setFrom(new InternetAddress(
    "[email protected]"));    newMessage.addRecipient(Message.RecipientType.TO,
    new InternetAddress("[email protected]"));    newMessage.setSubject(subject);
    newMessage.setSentDate(new Date());
    newMessage.setText(subtext); newMessage.saveChanges();
   Transport transport = sessions.getTransport("smtp");
   transport.connect("smtp.163.com", "username", "password");
    transport.sendMessage(newMessage, newMessage.getAllRecipients());
    transport.close(); %>
<p>send mail success<p>
<%
   }   catch (MessagingException m)   {
    out.println(m.toString());   }
   }
 %>结果提示的错误是:
Error 404--Not Found 
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.