gpt4 book ai didi

lotus-notes - Lotus Notes - 将电子邮件导出到纯文本文件

转载 作者:行者123 更新时间:2023-12-04 03:19:13 25 4
gpt4 key购买 nike

我正在设置一个 Lotus Notes 帐户来接受来自客户端的电子邮件,并自动将每封电子邮件保存为纯文本文件以供其他应用程序处理。

因此,我正在尝试在 Lotus 中创建我的第一个代理,以自动将电子邮件导出为文本。

是否有标准的最佳实践方法可以做到这一点?

我已经创建了一个非常有效的 LotusScript Agent。但是,有一个错误 - 一旦备忘录正文超过 32K 个字符,它就会开始插入额外的 CR/LF 对。

我使用的是 Lotus Notes 7.0.3。

这是我的脚本:

 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 = "\\PASCRIA\CignaDFS\CUser1\Home\mikebec\MyDocuments\"
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 "\\PASCRIA\CignaDFS\CUser1\Home\mikebec\MyDocuments\email_" & 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

更新显然 32KB 问题并不一致 - 到目前为止,只有一个文档在 32K 之后开始获得额外的回车符。

最佳答案

关于 32Kb 的东西,而不是这个:

Set bodyRichText = doc.GetFirstItem( "Body" )

...您可能需要考虑迭代电子邮件文档中的所有“正文”字段。在处理大量富文本时,Domino 将所述内容“分块”到多个富文本字段中。检查您正在处理的一些文档:当您查看文档属性时,您可能会看到“正文”字段的多个实例。

关于lotus-notes - Lotus Notes - 将电子邮件导出到纯文本文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2291073/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com