cancel
Showing results for 
Search instead for 
Did you mean: 

Encrypted Email and the Outlook VBO

ewilson
Staff
Staff
I'm posting this as a top-level discussion for anyone that may be looking for an answer to the question of whether the Outlook VBO can be used to send encrypted/signed emails.

I've looked into this a bit based on information I've found on the internet. Creating an encrypted email in Outlook is pretty easy when you do it manually via the UI (assuming your Outlook client or Exchange server are properly configured). Microsoft provides a handy little button titled Encryption on the Options tab.

25641.png
Unfortunately, doing this programmatically via interop with Outlook is bit more of a pain. 🤦‍♂️ Below is some code you can add to the Code stage in the Send Email action of the MS Outlook Email VBO that should allow you to encrypt and/or sign emails (assuming you have an appropriate certificate installed and configured):

Const PR_SECURITY_FLAGS As String = "http://schemas.microsoft.com/mapi/proptag/0x6E010003"

' Check flags for Encryption and Signing.
If (Encrypt_Message) And (Sign_Message) Then 
	mail.PropertyAccessor.SetProperty(PR_SECURITY_FLAGS, &H3)
ElseIf (Encrypt_Message) Then
	mail.PropertyAccessor.SetProperty(PR_SECURITY_FLAGS, &H1)
ElseIf (Sign_Message) Then
	mail.PropertyAccessor.SetProperty(PR_SECURITY_FLAGS, &H2)
End If
​


If you choose to add this code to your VBO, I would recommend that you create a backup copy of the VBO to make it easier to rollback should you encounter any issue.

You can add the code anywhere in the Code stage titled Send Item of the Send Email action so long as it's after the line where the variable mail is defined and initialized:

25642.png
And before the two lines at the end of the Code stage where the mail item is saved and actually sent:

25643.png
There are a few things to be aware of though:

  • There are other examples on the internet that show this in a slightly cleaner fashion. In those cases they are performing a bitwise OR of any existing value of the PR_SECURITY_FLAGS property and the new value. That's all well and good, but my personal testing in v6.10.4 shows that when you try to pass any sort of VB.NET variable into the SetProperty call results in a Type Mismatch exception. That's why I have 3 separate lines that basically do the same thing just with a different hardcoded value at the end. I tried using variables of type Long, Integer, UInteger, ULng, Int16, Int32, Object, and String. None of them worked. 🤷‍♂️
  • The code above expects that you'll define two input variables on the Send Email action called Encrypt Message and Sign Message, and those will be passed into the Code stage. Those variables are of type Flag.
  • VERY IMPORTANT: If you make this change and you call the action on a machine who's Outlook installation has NOT been previously configured to support sending emails with encryption and signing, a pop-up window, from Outlook, will block the BP process from moving ahead. The pop-up is basically a message stating that the Outlook client has not been configured with a proper Digital ID certificate that can be used for encryption and/or signing. At that point all you can do is click the OK button on the dialog to dismiss it. When you do that, you'll receive an exception in the Code stage stating that the action was aborted.

UPDATES
20220218 - There is another option for supporting encryption in emails that we're investigating. It involves the use of Sensitivity Labels and Azure Information Protection. This only apples to users of Microsoft 365 though. Currently, the Microsoft VBOs (Excel, Word, and Outlook) do not support Sensitivity Labels, but it is a feature we're looking at adding. With Sensitivity Labels, a specific label can be applied to files/email, either automatically or manually, that results in the file/email being encrypted. You can track the progress of this work, as well as vote for it, through the DX Ideas Portal.

#Outlook #EncryptedEmail
 
Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------​​​
7 REPLIES 7

Hi Eric,

Many thanks for summarize all this functionality. Really helpfull!!


Bye 🙂

------------------------------
Pablo Sarabia
Architect
Altamira Assets Management
Madrid
634726270
------------------------------

Great solution posted there @ewilson . I will try it sometime for sure at my end 🙂 ​​​

------------------------------
----------------------------------

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please provide a big thumbs up so that the others members in the community having similar problem statement can track the answer easily in future.

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Technical Business Analyst,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------

Thanks @ewilson for detailed explanation. I was looking for the solution as asked on another thread as well.  You are too good :)​

------------------------------
Neeraj Kumar
Technical Architect
------------------------------

esaugos
Level 6
Thanks @ewilson for the solution and detailed explanation. I Appreciate the efforts you put in this topic.​

------------------------------
Saurabh Goswami
RPA Architect
Ericsson
------------------------------
RPA Solution Architect

Rambo27
Level 8
Appreciate your help  @ewilson .Nice case to include for mail automations 

------------------------------
Shikhar Mishra
RPA Lead
Infosys Pvt Ltd
Pune,India
------------------------------
Shikhar Mishra RPA Lead Infosys

RaviKumar3
Level 5
Great Solution Eric, thanks for sharing.

------------------------------
Ravi Kumar
Sr Automation Designer
Ericsson
Asia/Kolkata
------------------------------

Thank you @ewilson for fantanstic solution.​​

------------------------------
Nilesh Jadhav
Senior RPA Specialist
ADP
India
------------------------------
Nilesh Jadhav.
Consultant
ADP,India