Forum Discussion

DabearMDF58's avatar
DabearMDF58
Copper Contributor
Apr 03, 2024

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

    • DabearMDF58's avatar
      DabearMDF58
      Copper Contributor
      Hey Lain,
      I have tried both properties and then both come up blank.
      • LainRobertson's avatar
        LainRobertson
        Silver Contributor

        DabearMDF58 

         

        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

Resources