Q

Fetch e-mails in Domino using Java

I am trying to fetch e-mail messages in Domino using Java (DCO and Lotus Domino packages). I want to fetch messages with a given message ID from the user's inbox folder. How do I do that?
The Message ID is contained in the $MessageID field. For example, a newsletter from SearchDomino.com had the message ID "<20030702151524.57275282A@mailhost11.lists.techtarget.com>". To get a handle on this document in a users inbox, you could use the following code:
Sub Initialize
  Dim s As New NotesSession
  Dim db As NotesDatabase
  Dim view As NotesView
  Dim doc As NotesDocument
  Dim docNext As NotesDocument
  Dim item As NotesItem
  Dim strMessageID As String
  
  strMessageID =
 "<20030702151524.57275282A
@mailhost11.lists.techtarget.com>"
  
  Set db = s.GetDatabase("server", 
"mailfilename")
  Set view = "($InBox)"
  Set doc = view.GetFirstDocument
  While Not(doc Is Nothing)
    Set item = doc.GetFirstItem("$MessasgeID")
    If item.text = MessageID Then
      ' --- add whatever code you need to 
'process the document the way you wish
      ' --- possibly : Call doc.Remove
      Goto singleExit
    End If
    Set doc = dc.GetNextDocument(doc)
  Wend
  
singleExit:
  
End Sub

This was first published in September 2003

Dig deeper on Domino Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close