Lotusscript:将文件从电子邮件转换为 base64 以在 POST 方法中发送

Lotusscript: Convert files from an email to base64 to send it in POST method

我正在寻找一种通过 POST 方法将我的文件发送到我的服务器的方法。但首先我想将我的文件转换为 base64,以便我可以轻松发送它们。只是,我在互联网上找不到任何解决方案 that.I 我什至不确定这样做是不是个好主意。

我尝试了几种方法,包括直接从附件中转换或将它们保存在本地并检索它们,但都没有用。

这是我的代码:

pathname = "C:\temp"
Set db = Session.Currentdatabase
    Set CurrentDocColl = db.Unprocesseddocuments
    Set doc = CurrentDocColl.Getfirstdocument
    While Not doc Is Nothing
        Set item = doc.GETFIRSTITEM("Body")
        If doc.HasEmbedded Then
            ForAll attachment In item.EmbeddedObjects
                Call attachment.ExtractFile (pathname & "\" & attachment.Name)
                Set stream = session.Createstream()
                stream.Open pathname & "\" & attachment.Name, "binary"

                'I want retrieve the file in base64 here
                data = 'file in base64

                Set http=session.CreateHTTPRequest()
                http.preferstrings = True
                http.Post(url, data) 

            End ForAll
        End If
        Set doc=CurrentDocColl.Getnextdocument(doc)
    Wend

此代码可以在我负责检索当前电子邮件中存在的信息的代理中找到。

有人知道怎么做吗?或者用另一种方法来做同样的事情?

您可以在 Julian Robicaux 的旧 NSFTools 网站上找到一些在 LotusScript 中处理 base64 数据的有用函数:https://www.nsftools.com/tips/Base64v14.lss