Removing attachments from forwarded mail

M

Mohan Bisht

Hi,

I am working on a com Add-in in VC++ which handles OnSend() event,
the Add-in is linked to in this event it MSOUT9.olb, My requirement is that
I should modify the attachments, basically encrypt/decrypt them on user's
demand. and then re-attach them, back to the original mail, For which I do
the following.

Outlook::_MailItemPtr pMailItem, which points to current mail Item
Outlook::_AttachmentsPtr pAttachments;
pMailItem->get_Attachments(&pAttachments);
long attach_count;
pAttachments->get_Count(&attach_count);

for(int cnt=attach_count;cnt>=1;cnt--)
pAttachments->Remove(cnt);

The whole thing works for a new mail item, but not for forwarded mail items
containing mail attachments.

for forwarded mail items, I do the following, besides what it is done above
Outlook::_MailItemPtr pForwardedMail;
pMailItem->Forward(&pForwardedMail);

Outlook::AttachmentsPtr pAttachments;
pForwardedMail->get_Attachments(&spAttachments);

long attach_count;
pAttachments->get_Count(&attach_count);

for(int cnt=attach_count;cnt>=1;cnt--)
pAttachments->Remove(cnt);

and then I send
the original mail,


The problem is when i receive the mail I receive 2 attachments, one that is
modified and added by me and the other the forwarded attachment in the
initial mail.

Can any budy help me in way to remove attachments from forwarded mail and
update the new mail. before it is send.

with regards
mohan Bisht
 

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