Forum Discussion
DabearMDF58
Apr 03, 2024Copper Contributor
Trying to Send IRM Encrypted Email But Body Of Email Is Blank
0
I am writing a script that will open an encrypted Outlook Template File to send and encrypted email. However, the body of the email is not popluating. Code below. Any help would be appreciated.
$outlook = New-Object -ComObject outlook.application $Mail=$outlook.CreateItemFromTemplate(“C:\Users$env:UserName\AppData\ Roaming\Microsoft\Templates\Encrypted.oft”) $Mail.SentOnBehalfOfName = “UnattendedEmailAddress” $Mail.To =“VendorEmailAddress” $Mail.CC = “HelpDeskEmailAddress” $Mail.Subject = “User With The Email $Vendor Was Not Found” $Mail.Body = ‘Please Double Check The Vendors Email Address And Then Enter It Again’ $Mail.save() $inspector=$Mail.getinspector $inspector.display() #$Mail.Send()
7 Replies
Sort By
- LainRobertsonSilver Contributor
Hi, Matthew.
I can't see enough of your screenshot to confirm which message composition mode is your default, however, if it happens to be HTML (it will display at the end of the window title as shown in the example below) then you need to populate the HTMLBody property, not the Body property - per your current example.
Cheers,
Lain
- DabearMDF58Copper ContributorHey Lain,
I have tried both properties and then both come up blank.- LainRobertsonSilver Contributor
Did you assign HTML content to that attribute?
$Mail.HTMLBody = "<html><body>Please Double Check The Vendors Email Address And Then Enter It Again</body></html>";
Cheers,
Lain