I'm working on a little script in VBA that would allow me to automatically forward messages, including encrypted ones.
The only problem I have is removing the encryption programmatically.
I thought I could do it like this:
- Open the message
- unselect the Encrypt & Sign options
- forward message
With this approach I don't know how to get a reference to the Encrypt & Sign buttons.
Here's the code that works for standard, non encrypted mails. I set this method as an "Email rule" for all incoming mails:
Sub test_macro(MyMail As MailItem)
MyMail.Display
'Need some API here to access the decrypt button
MyMail.Recipients.Add "[email protected]"
MyMail.Recipients.Add "[email protected]"
Item_Send (MyMail)
End Sub
Background
There's a requirement here to forward all incoming messages for a department address to certain people. Forwarding them encrypted causes all sorts of certificate issues between various versions of Outlook (2003/2007/2010/etc) since they all need to have the private key of the department address and that seem to conflict with their personal account certificate (I get all sort of erratic behavior, sometimes it works, sometimes not).
Alternative approaches
I realize that because of security restrictions the current approach will probably not work so I'm looking into alternatives. Maybe if I create a plugin for Outlook, will that give me access to some security API to decrypt incoming messages?
Create a POP client, fetch, manually decrypt the messages and forward it. This is probably the hardest approach since there are a lot of encryption formats/algorithms wich Outlooks supports by default.
Any other ideas? Thanks!