如何保存收到的邮件的数字签名

时间:2010-07-21 12:24:17

标签: vba outlook-2007 digital-signature digital-certificate

我正在尝试保存当前打开的邮件项目的数字签名。

现在我意识到Outlook阻止访问以编程方式加密/签署新电子邮件。在这里,我专注于收到的消息。

到目前为止,我只能使用MessageClass属性来检测已签名的电子邮件。

Function GetCurrentItem() As Object
    Dim objApp As Outlook.Application

    Set objApp = CreateObject("Outlook.Application")
    On Error Resume Next
    Select Case TypeName(objApp.ActiveWindow)
        Case "Explorer"
            Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
        Case "Inspector"
            Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
        Case Else
            ' anything else will result in an error, which is
            ' why we have the error handler above
    End Select

    Set objApp = Nothing
End Function

Sub DoExport()
    Set CurrentItem = GetCurrentItem()
    If CurrentItem.MessageClass = "IPM.Note.SMIME.MultipartSigned" Then
        MsgBox CurrentItem.MessageClass 
    End If
End Sub

1 个答案:

答案 0 :(得分:0)

即使在加密和签名的邮件上,Messageclass似乎总是“IPM.Note” 我用这段代码来读取谁签了邮件 Set PropertyAccessor = mailitem.PropertyAccessor
If PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/id/{00020328-0000-0000-C000-000000000046}/9104001f") <> "" Then
END
End If