How to export Lotus Notes emails to plain text file

346285 pts.
Tags:
Lotus Notes
Lotus Notes email
My friend has been trying to set up a Lotus Notes account to accept emails from a client / save each email as a text file that will be processed by another application. So he's been looking to create an Agent that automatically exports the emails to text. He wants to know what's the best way to do this. The Agent that he created works but after body of the email reaches 32K characters, it's inserting extra CR/LF pairs. He's using Lotus Notes 7.0.3. Also, here's the script he's using:
Sub Initialize
 On Error Goto ErrorCleanup
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim doc As NotesDocument
 Dim uniqueID As Variant 
 Dim curView As NotesView
 Dim docCount As Integer
 Dim notesInputFolder As String 
 Dim notesValidOutputFolder As String
 Dim notesErrorOutputFolder As String 
 Dim outputFolder As String
 Dim fileNum As Integer
 Dim bodyRichText As NotesRichTextItem
 Dim bodyUnformattedText As String
 Dim subjectText As NotesItem

 '''''''''''''''''''''''''''''''''''''''''''''''''''''''
 'INPUT OUTPUT LOCATIONS 
 outputFolder = "\PASCRIACignaDFSCUser1HomemikebecMyDocuments"
 notesInputFolder = "IBEmails" 
 notesValidOutputFolder = "IBEmailsDone"
 notesErrorOutputFolder="IBEmailsError"
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''

 Set db = session.CurrentDatabase
 Set curview = db.GetView(notesInputFolder ) 
 docCount = curview.EntryCount
 Print "NUMBER OF DOCS "  & docCount
 fileNum = 1
 While (docCount > 0)
  'set current doc to 
  Set doc = curview.GetNthDocument(docCount)

  Set bodyRichText = doc.GetFirstItem( "Body" )
  bodyUnformattedText = bodyRichText.GetUnformattedText()
  Set subjectText = doc.GetFirstItem("Subject")
  If subjectText.Text = "LotusAgentTest" Then
   uniqueID = Evaluate("@Unique")
   Open "\PASCRIACignaDFSCUser1HomemikebecMyDocumentsemail_" & uniqueID(0) & ".txt" For Output As fileNum
   Print #fileNum, "Subject:" & subjectText.Text
   Print #fileNum, "Date:" & Now
   Print #fileNum, bodyUnformattedText
   Close fileNum
   fileNum = fileNum + 1
   Call doc.PutInFolder(notesValidOutputFolder)
   Call doc.RemoveFromFolder(notesInputFolder)
  End If
  doccount = doccount-1
 Wend
 Exit Sub
    ErrorCleanup: 
     Call sendErrorEmail(db,doc.GetItemValue("From")(0))
     Call doc.PutInFolder(notesErrorOutputFolder)
     Call doc.RemoveFromFolder(notesInputFolder)
    End Sub
He appreciates the help.

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following