Changing Content-Type of MailItem

C

CuSo4

Hi,

I'm trying to develop an Outlook Add-in in C# that intercepts outgoing
emails with the "ApplicationEvents_11_ItemSendEventHandler" and modifies the
message. The Add-in should also change the "Content-Type" header of the
message.

It seems like the "MailItem" interface does not expose properties to
manipulate the "Content-Type" header, and I suspect the headers are not set
yet when the ItemSend event is fired, but does someone know any other way to
achieve this?

Thanks in advance!
 
C

CuSo4

Dmitry,

Thanks for your reply!

As part of my master thesis, I implemented an RSA CSP in c# that allows to
create digital signatures on smart cards. I'm able to use this CSP to create
smartcard based S/MIME detached signatures for emails.

For my demo, I would like to integrate this functionality in an Outlook
Add-In. Basically, I retrieve the Body from the MailItem upon sending,
compute the S/MIME signature, and add it as an attachment to the MailItem.

However, client email applications are not able to interpret the S/MIME
attachment, as the Content-Type header is "multipart/mixed". I should set it
to "multipart/signed" instead.

I read about setting the message class to IPM.Note.SMIME.MultipartSigned,
but if I understand it correctly, this will cause outlook itself to sign the
email. As the goal is to demonstrate the use of the RSA CSP using c#, setting
the message class to IPM.Note.SMIME.MultipartSigned is not of much help in
this case...
 
D

Dmitry Streblechenko

If you need to be able to control the MIME structure of the outgoing
message, you need to implement a transport provider thaat explciitly
converst a MAPI message to a MIME message.
In some cases (e.g. when a message is sent between two Exchange mailboxes),
the message might not even be ever converted to MIME.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
C

CuSo4

Thanks for the insight!
Actually, as I wanted to keep it in c#, I implemented an smtp proxy that
does the job.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top