2 Replies Latest reply on Sep 7, 2006 2:22 PM by Peter Pei Guo

    Configure JavaMail in JBoss

    Peter Pei Guo Newbie

      I am looking for a way to configure JavaMail in JBoss, so that I can send mail by looking up context. I did find something online, but the information was really old, and I couldn't even find the the files mentioned (I amusing version 4, and the post was for version 2).

      Please help. Thanks,
      Peter

        • 1. Re: Configure JavaMail in JBoss
          fss Newbie

          This post should be in: Installation, Configuration & Deployment

          you can configure your mail-properties in deploy/mail-service.xml.

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE server>
          <!-- $Id: mail-service.xml,v 1.5.6.1 2005/06/01 06:20:43 starksm Exp $ -->
          
          <server>
          
           <!-- ==================================================================== -->
           <!-- Mail Connection Factory -->
           <!-- ==================================================================== -->
          
           <mbean code="org.jboss.mail.MailService" name="jboss:service=Mail">
           <attribute name="JNDIName">java:/TESTMail</attribute>
           <attribute name="Configuration">
           <configuration>
           <property name="mail.transport.protocol" value="smtp"/>
           <property name="mail.smtp.host" value="testmail.test.de"/>
           <property name="mail.debug" value="false"/>
           </configuration>
           <depends>jboss:service=Naming</depends>
           </attribute>
           </mbean>
          
          </server>
          


          From your code you get the mailsession with a normal jndi loookup
          Object objref = context.lookup(_mailSessionJNDI);
          Session mail (Session) PortableRemoteObject.narrow(objref, Session.class);