Sending encrypted message using CDO

Sending encrypted message using CDO

Post by Vladimir Kozlof » Tue, 24 Sep 2002 19:17:56

Hello All,

How I can send encrypted and signed message using CDO?
Give me a code sample if possible.



1. Creating Encrypted Messages with CAPICOM / CDO

I am having a problem generating an encrypted message using the
CAPICOM DLL and CDO. I am using the example article Q280391 found on

The only change I have made to the EnvelopeMessage function is that I
create a new CDO.Message object within the function, rather than
passing it in as a parameter. I have made the same modification to the
SignMessage function and had no problems; SignMessage worked exactly
as desired (my goal in both cases being to produce a .EML file that
can then be sent via Exchange or a 3rd party mail component that can
send EML files).

Code Segment:

    Dim oMsg            As New CDO.Message
    Dim oBodyPart1      As CDO.IBodyPart

    ' Set To/From/Subject
    With oMsg

        .subject = "Test - Signed Message"
        .TextBody = "Just a test"
    End With

    ' Set up main bodypart
    Set oBodyPart1 = oMsg
    oBodyPart1.Fields("urn:schemas:mailheader:content-type") =
= "base64"
    oBodyPart1.Fields("urn:schemas:mailheader:content-disposition") =

The line setting the urn:schemas:mailheader:content-disposition field
is causing a problem. If I comment that out, .Update will succeed,
otherwise I receive the following error:

'Fields update failed. For further information, examine the Status
of individual field objects.'

Checking the content-disposition field gives me a Status of 65544. I
cannot, however, locate a list of the error codes to see what the
problem is.

If anyone has had a similar problem and/or can help I would greatly
appreciate it..

Thanks in advance..

2. Exchange 5.5 on W2K Advanced Server

3. Sending messages using CDO

4. STORE.exe Memory!

5. sending message from an asp page using cdo

6. Mailbox manager

7. sending messages using CDO

8. Distibution Lists

9. Send Message to Mobile device using CDO.

10. Encrypting messages using word as email editor

11. Sending encrypted/signed message programmatically

12. OWA Sends Encrypted Messages

13. sending and receiving S/MIME encrypted messages inside a dotnet-application