If you use the JavaMail API directly you have to provide, in some ways, configuration items such as mail host, protocol, login, password, etc etc

The mail-service.xml contained in the deploy directory is a sample that you can copy to get your own MailSession. That way, you retrieve your mail session automatically and you can act on it

That's very cool actually. just define your settings, retrieve the session using JNDI and you have your mail session ready.

Here is a sample:

Session session = (Session) PortableRemoteObject.narrow(
                    new InitialContext().lookup("java:/KialaMail"), Session.class);
// Message msg = .... create the message using your session
Transport.send(msg);

In your deploy you might have something like:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<!-- $Id: kiala-mail-service.xml,v 1.1.2.1 2003/08/28 10:12:03 snicoll Exp $ -->

<server>
  <classpath codebase="">              archives="mail.jar, activation.jar, mail-plugin.jar"/>
 
  <!-- ==================================================================== -->
  <!-- Kiala Mail Connection Factory                                        -->
  <!-- ==================================================================== -->

 
  <!-- Configuration doc
    
      * mail.store.protocol: the protocol used to get email (pop3)
      * mail.transport.protocol: the protocol used to send email (smtp)
      * mail.user: redondant with user?     
      * mail.pop3.host: host to use when dealing with pop3
      * mail.smtp.host: host to use when dealing with smtp
      * mail.from: return address of sent email
      * mail.debug: true turns debugging on 
  -->
  <mbean code="org.jboss.mail.MailService"
         name="kiala.kserver.notification:service=Mail">
    <!-- the JNDI name where this mail session will be bound -->   
    <attribute name="JNDIName">java:/KialaMail</attribute>
    <!-- the user used to connect to the mail server -->
    <attribute name="User">theuser</attribute>
    <!-- the password used to connect to the mail server -->
    <attribute name="Password">thepassword</attribute>
    <!-- this is standard JavaMail configuration -->   
    <attribute name="Configuration">      
      <configuration>   
          <property name="mail.store.protocol" value="imap"/>
          <property name="mail.transport.protocol" value="smtp"/>
          <property name="mail.imap.host" value="localhost"/>
          <property name="mail.smtp.host" value="localhost"/>
          <property name="mail.from" value="toto@company.org"/>
          <property name="mail.debug" value="false"/>
       </configuration>
    </attribute>
  </mbean>
</server>

Any question, let us know

Regards,

Stéphane Nicoll
Kiala





On Fri, 2003-08-29 at 09:13, [EMAIL PROTECTED] wrote:
What are the benefits of using the JavaMail service in JBoss vs using the
JavaMail api directly?

thanks.
.peter



----------
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,is for the sole use of the intended recipient(s), even if addressed incorrectly, and may contain confidential and privileged information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply e-mail and destroy or delete all copies of the original message and all attachments, including deletion from the trash or equivalent folder.  Thank you.

Reply via email to