Originally Posted by
GMan
Well, here is proof that if you hunt around long enough you will find something that gets you close to what you are looking for. To solve my above questions I came up with the following macro. The only compromise I had to make is to not search inside attached files. So instead, I prompt the user to see if the mail should be encrpted if there is an attachment.
[vba]Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Const cSSN = "SSN"
Dim strMsg As String
Dim stBody As String
Dim res As Long
Dim flSSN As Boolean
stBody = Item.Body
If Item.Attachments.Count <> 0 Or _
InStr(1, stBody, cSSN) > 1 Then
strMsg = "Should this E-mail be Encrypted?" 'set Message
res = MsgBox(strMsg, vbYesNo, "Encryption") 'Display Message
If res = 6 Then 'Check if selected YES
MsgBox "Please follow your normal encryption process", vbInformation, "Encrypt E-mail"
Cancel = True 'Yes Clicked, do not send
End If
End If
End Sub[/vba]