Reputation: 11
Please help me with an PowerShell script to send an encrypted email on Outlook application. I have a PowerShell script to send mail with attachments on Outlook application but want to encrypt that mail.
$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "mail"
$Mail.Subject = "Action"
$Mail.Body = "Hi Aviral, Good to see you"
$file = "C:\Users\a.raghorte\Desktop\UNIX\Utilization.txt"
$Mail.Attachments.Add($file)
$Mail.Send()
Upvotes: 1
Views: 2582
Reputation: 63
$Mail.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x6E010003", 0x03)
That should do the trick while Outlook is running. If outlook is not running, the Mail goes to "Outbox" without signature/encryption.
0 = none, 1 = sign, 2 = encrypt, 3 = both
Upvotes: 3