Yves VIOT
What you might do is create an enveloped message in a mail client and then
look at the raw message data to see how the body parts are composed.
It may also be necessary to mess around with System.Net.Mime to get the body
parts working correctly. Hopefully this doesn't require using CDO via COM
interop.
Joe K.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"VIOT Yves" <yves...@csis.fr> wrote in message
news:%23Mcsqjs...@TK2MSFTNGP03.phx.gbl...
---------------------------------------------------------------------------------------------------
content-type: application/pkcs7-mime; smime-type=enveloped-data
content-disposition: attachment;FileName="smime.p7m"
mime-version: 1.0
From: x...@xxx.xx
To: x...@xxx.xx
date: 18 Oct 2006 17:50:42 +0200
subject: Test
content-type: text/plain; charset=utf-8
content-transfer-encoding: base64
---------------------------------------------------------------------------------------------------
Dim envelop As System.Security.Cryptography.Pkcs.EnvelopedCms
Dim content As System.Security.Cryptography.Pkcs.ContentInfo
Dim unicode As New System.Text.UnicodeEncoding
Dim alg As System.Security.Cryptography.Pkcs.AlgorithmIdentifier
Dim recipient As System.Security.Cryptography.Pkcs.CmsRecipient
alg = New System.Security.Cryptography.Pkcs.AlgorithmIdentifier( _
New Oid("1.2.840.113549.3.7", "3des"), 128)
content = _
New System.Security.Cryptography.Pkcs.ContentInfo( _
unicode.GetBytes((New System.IO.StreamReader(str_File)).ReadToEnd))
recipient = New System.Security.Cryptography.Pkcs.CmsRecipient( _
GetRecipientCert)
envelop = New System.Security.Cryptography.Pkcs.EnvelopedCms(content, alg)
envelop.Encrypt(recipient)
obj_SMTPClient = New SmtpClient(str_MailSMTPServer, _
str_MailSMTPServerPort)
obj_Message = New MailMessage(str_From, str_To, "Test",
unicode.GetString(envelop.Encode()))
obj_Message.Headers.Remove("Content-Type")
obj_Message.Headers.Add("Content-Type", "application/pkcs7-mime;
smime-type=enveloped-data")
obj_Message.Headers.Add("Content-Disposition",
"attachment;FileName=""smime.p7m""")
obj_SMTPClient.Send(obj_Message)
---------------------------------------------------------------------------------------------------
Joe Kaplan a écrit :
Joe K.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"VIOT Yves" <yves...@csis.fr> wrote in message
news:uWLAx1s8...@TK2MSFTNGP05.phx.gbl...
Joe Kaplan a écrit :
I've the same problem. It seems that NET 2.0 is not able to send a
SMIME email message.
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=149485
Have you found any solution?
Fabrizio
Yves
fhtino a écrit :