将xml文件附加到mimeentity会导致Notes服务器崩溃

时间:2017-06-13 17:32:46

标签: java xml email lotus-notes lotus-domino

在Java代理中,我生成一封邮件。当我仅发送文本时,邮件将发送给收件人。我还想将xml文件附加到邮件中。如果我附上它我的笔记本服务器崩溃了。

我认为我的代码错了,这是我要将附件添加到邮件的部分:

         mime = mimeRoot.createChildEntity();
         MIMEHeader hdr = mime.createHeader("Content-Disposition");
         hdr.setHeaderValAndParams("attachment; filename=" + OrderFilePath); 
         Stream stream = session.createStream();
         System.out.println("Open stream");
      //AT THIS IF IT WILL CRASH THE SERVER
         if (stream.open(OrderFilePath, "binary")){
             System.out.println("in eerste if");
             if (stream.getBytes() != 0) {
                 System.out.println("getbytes !0 ");
                   mime.setContentFromBytes(stream, "application/octet-stream",MIMEEntity.ENC_IDENTITY_BINARY);

             }
               else System.out.println
                 (OrderFilePath + "has no content or is not working");
             }

1 个答案:

答案 0 :(得分:0)

我有一些工作的LotusScript代码几乎完全相同,但有两行除外:

 select DATEPART(week, CAST([submissionDate] as date)) as [weeks],sum(qty) 
 as [Zen Usage] FROM [zicucfbu_MIS].[dbo].[FileUploadDetails] where [route] 
 like 'ZENIT_WS%' and DATEPART(week, CAST([submissionDate] as date)) = 
 DATEPART(week, cast(GETDATE() as date))  
 and year(CAST([submissionDate] as date)) = year(cast(GETDATE() as date))
 group by DATEPART(week, CAST([submissionDate] as date))  order by weeks

hdr.setHeaderValAndParams("attachment; filename=\\"" + OrderFilePath + "\\""); 

我的LS代码,所以你可以自己看看:

mime.setContentFromBytes(stream, "application/octet-stream; name=\\"" + OrderFilePath + "\\"",MIMEEntity.ENC_IDENTITY_BINARY);

附件附件对象的列表,仅包含附件的名称和文件路径;它不是一个完整的Notes附件嵌入对象的东西。