Stephen,

I haven't done this ...but my friend did. Took a look at his code.

Bit of an ugly/inelegant  fix but what he did was....

He used 'J-Integra' software (http://www.linar.com/) to make some COM objects 
accessible through Java - in this case the COM objects were the 'Collaboration Data 
Objects' (CDO - these provide an API to MS Exchange - if you don't already have them 
available they can be downloaded).

Then he could talk to his java-wrapped CDO objects (from a servlet) to get them to do 
what he wanted (read mail/send mail  - whatever you need). This is the bit that 
(although it ultimately worked very well) did prove fiddly and ugly to code (see 
example below).

Hope this helps you in some way - it should actually do the job - but I'd be 
interested in a better solution.

J

p.s. I've included some code below used for simply reading the number of messages in 
the inbox:
______________________________________________
import cdo.*;
import java.io.IOException;
import com.linar.ocxhost.*;
import com.linar.jintegra.*;

public class MyClass1 {

  public MyClass1() throws IOException {

    try {

      //Create the Session object
      com.linar.ocxhost.Container container = new com.linar.ocxhost.Container();
      Session objSession = new Session(container.create("MAPI.Session.1"));

      //Logon
      objSession.logon("Microsoft Outlook", null, null, null, null, null, null);

      //Get the Messages object
      Folder objInbox = new FolderProxy(objSession.getInbox());
      Messages objMessages = new MessagesProxy(objInbox.getMessages());
      AddressEntry currentUser = new AddressEntryProxy( objSession.getCurrentUser() );

      //Display the number of messages in this folder
      System.out.println( currentUser.getName() + " has " + objMessages.getCount() + " 
messages in his inbox." );

      //Logoff
      objSession.logoff();

    } finally {
      Cleaner.releaseAll();
    }

  }

  public static void main(String[] args) throws IOException {
    //com.linar.jintegra.AuthInfo.setDefault("oasislan", "smitha", "");
    System.setProperty("JINTEGRA_LOG_FILE", "c:\\temp\\log.txt");
    System.setProperty("JINTEGRA_LOG_LEVEL", "3");
    MyClass1 myClass1 = new MyClass1();
  }

}
___________________________
-----Original Message-----
From:   Lambert, Stephen : CO IR [SMTP:[EMAIL PROTECTED]]
Sent:   02 June 2000 10:26
To:     [EMAIL PROTECTED]
Subject:        Servlet reading email from MS Exchange?

Greetings,

Has anyone ever thought of trying (or attempted) to read email from an MS
Exchange mail server using a servlet?

Or does just the mere thought of doing this make you want to cringe?
Is this scheme far beyond the capabilities of a servlet?

I would be interested in knowing what discoveries and/or difficulties one
would have to endure to be successful at using a servlet to read the
contents of an email into a database.

Any feedback would be appreciated.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html




*******************************************************************
This email and any files transmitted with it are confidential and
are solely for the use of the individual or organisation to whom
they are addressed. If you have received this mail in error please
notify the system administrator at +353 1 6399700 or by email to
[EMAIL PROTECTED]

This email message has been swept for computer viruses.

Managed Solutions Corporation,
Enterprise Customer Relationship Management, Workflow and Contract
Administration.

        Tel: 353 1 639 9700
        Fax: 353 1 639 9701

Don't forget to visit our website at http://www.managed-solutions.com
********************************************************************

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to