Following is the code, the error message is "can't find smtp host", but I can 
receive Mail with my code, who can tell me why?
Thanks.
+++++++++++++++++++++++++++++++++++++++++++++
public class Servlet1
    extends HttpServlet {
  static class  BasicAuthenticator extends Authenticator {
              protected PasswordAuthentication getPasswordAuthentication( ) {
                  
                return new PasswordAuthentication("myname", "mypw");
              }
        }

  private static final String CONTENT_TYPE = "text/html; charset=GBK";
  InitialContext cxt;
  Session sess,sess1;
  
  public void init() throws ServletException {
    try{
      Properties p = System.getProperties();
         p.put("mail.smtp.host", "smtp.126.com");
                  cxt=new InitialContext();
                  sess1=(Session)cxt.lookup("java:comp/env/mail/DefaultMail");
                 sess= sess1.getInstance(p,new BasicAuthenticator());
                  
                  Message msg = new MimeMessage(sess);
               

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963550#3963550

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963550
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to