I want to send an encrypted email.
I found this PR_SECURITY_FLAG code here on StackOverflow.
Const PR_SECURITY_FLAGS = "schemas.microsoft.com/mapi/proptag/0x6E010003"
FilePath = Application.ActiveWorkbook.FullName
FileName = Application.ActiveWorkbook.Name
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
ulFlags = ulFlags Or &H1 ' SECFLAG_ENCRYPTED
ulFlags = ulFlags Or &H2 ' SECFLAG_SIGNED
With OutMail
.to = recipient
.Subject = FileName
.HTMLBody = body & "<br>" & .HTMLBody
.PropertyAccessor.SetProperty PR_SECURITY_FLAGS, (ulFlags)
End With
I get
Run-time error '5': invalid procedure call or argument
on the .ProperyAccessor line.
I tried putting it in and out of the With statement.