Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Changing Content-Type of MailItem (http://www.outlookbanter.com/add-ins-outlook/69801-changing-content-type-mailitem.html)

CuSo4 April 4th 08 06:02 PM

Changing Content-Type of MailItem
 
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!

Dmitry Streblechenko April 5th 08 05:20 PM

Changing Content-Type of MailItem
 
Why exactly are you trying to do that?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"CuSo4" wrote in message
...
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!




CuSo4 April 5th 08 06:27 PM

Changing Content-Type of MailItem
 
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...

"Dmitry Streblechenko" wrote:

Why exactly are you trying to do that?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"CuSo4" wrote in message
...
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!





Dmitry Streblechenko April 7th 08 07:33 AM

Changing Content-Type of MailItem
 
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
-
"CuSo4" wrote in message
...
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...

"Dmitry Streblechenko" wrote:

Why exactly are you trying to do that?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"CuSo4" wrote in message
...
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!







CuSo4 April 9th 08 11:55 PM

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

"Dmitry Streblechenko" wrote:

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
-
"CuSo4" wrote in message
...
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...

"Dmitry Streblechenko" wrote:

Why exactly are you trying to do that?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"CuSo4" wrote in message
...
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!








All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com