I am trying send emails in the app I am creating.I know from the examples that 
I can use 
   
  Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session session = (Session) envCtx.lookup("mail/Session");
  Message msg = new MimeMessage(session)
  msg.addRecipients(recp);
  msg.addFrom(from);
  msg.setContent(messageText, "text/plain");
  Transport.send(msg)

  However, I would prefer to set up the MailSession by passing in a properties 
list to the similar to:
   
  Session mailSession = Session.getInstance(mailProperties, null);
  Message msg = new MimeMessage(session)
  msg.addRecipients(recp);
  msg.addFrom(from);
  msg.setContent(messageText, "text/plain");
  Transport.send(msg)

   
  mailhost is defined in my host file as: 10.1.1.120
   
  I also have the following defined in my web.xml:
   
  <resource-ref>
      <res-ref-name>mail/Session</res-ref-name>
      <res-type>java.xmail.Session</res-type>
     <res-auth>Container</res-auth>
     <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>
  
I am not sure what is missing from my machine. I have set my host, timout and 
debug flags. When I try to send the email I now get the message: 
java.net.NoRouteToHostException.
   
  Is thi smessage coming because I am currently not hooked up to a network? Do 
I need to set up something else on my server? Do I need network connectivity?
   
  TIA
   
  - Mike

       
---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out. 

Reply via email to