Thursday 7 June 2018

email - Encrypt Outlook Mail Programmatically via VBA




I am looking for a way to encrypt an Outlook Mail via VBA-code in Outlook 2013. That makro shall encrypt and send the mail.



I was hoping that i could simply access the mail object an simply call something like an "encrypt"-Method, but sadly Microsoft says, that "The Microsoft Outlook object model does not provide direct support to sign or encrypt mail messages programmatically", but it is possible to build a solution for it. (https://support.microsoft.com/de-de/help/2636465/how-to-sign-or-encrypt-mail-messages-programmatically)



Does anyone have an idea/code Snippet how to solve my Problem or where to look it up? I know i can encrypt mails manually via Outlook, but i would like to access it programmatically. Perhaps i can simply call like an event or something that is called when this property is set.



Thanks for your help and advice :)!



Edit: I do not have any Certificates i can use, is there even a way to encrypt mails in Outlook without using Certificates?


Answer




You will need to set the PR_SECURITY_FLAGS property. See https://blogs.msdn.microsoft.com/dvespa/2009/03/16/how-to-sign-or-encrypt-a-message-programmatically-from-oom/ for an example.


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...