如何将被阻止的文件类型添加为outlook邮件项目中的附件

本文关键字:outlook 项目 添加 类型 文件 | 更新日期: 2023-09-27 18:15:00

我正在尝试从邮件中提取附件,并将这些文件附加到另一个邮件项目。

一切都很好,但如果我试图添加一个附件,其中有一个阻止扩展,附件将不会被添加到邮件项目。以下是我所做的:

private void addAttachments( Redemption.RDOMail sourceMail , ref Redemption.RDOMail targetMail )                
{
    foreach (Redemption.RDOAttachment attachment in sourceMail.Attachments)
    {
        // Saving attachment files from source mail on local disk 
        attachment.SaveAsFile(/*File Path*/);
        // adding attachment to target mail from saved location
        //At this point, target mail has the attachment count incremented
        targetMail.Attachments.Add(/*File PAth*/ + attachment.DisplayName);
        // deleting file, saved on local disk
        File.Delete(/*File Path + attachment.DisplayName*/);                   
    }
    targetMail.Save();
    // when the mail item is being displayed, the added attachment with the *.EXE,
    //or all the other attachment extentions which are blocked from viewing by outlook is gone.
    // This does not happen for other attachment files
    targetMail.Display();
}

为什么这些特殊的附件类型不会显示?

如何将被阻止的文件类型添加为outlook邮件项目中的附件

为什么这些特殊的附件类型不会显示?

那是微软办公软件的功能,不是你的软件坏了。

根据微软的说法,有三个选项:

  • 使用共享服务器
  • 使用文件压缩工具
  • 重命名文件

我想添加第四个:

  • 更改被阻止的扩展列表

我会选择选项2,因为这是最容易实现的,而且不需要改变发送者和接收者的PC(你不能总是控制,这可能会有安全隐患)。