Sending Outlook template *.oft with inline images by powershell

Andronik Vadim 96 Reputation points
2021-12-02T06:43:20.27+00:00

Hello everyone!

I sending by powershell * .oft template, which contains pictures inline the text. For this I use comObject Outlook.Application. The recipient receives a message without pictures. The rest of the formatting is retained.
If i send this template from Outlook application, the recipient receives a valid email with inline pictures.
How to achieve saving images when sending a template by powershell?

Thanks for any suggestions

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,406 questions
{count} votes

Accepted answer
  1. Andronik Vadim 96 Reputation points
    2021-12-06T07:42:59.96+00:00

    I have found a solution for my question.
    I refused using *.oft in favor of *.msg. This code is working for me and saving images inline message:

    $PathToMsg = "c:\message.msg"  
    $mailboxes = "user@domain.ru"  
      
    $outlook = New-Object -comObject Outlook.Application   
    $session = $outlook.Session  
    $session.Logon()  
      
    $mail = $outlook.Session.OpenSharedItem($PathToMsg)  
      
    foreach ($mailbox in $mailboxes){  
        $mail.Forward()  
        $mail.Recipients.Add($mailbox)  
        $mail.To = $mailbox  
        $mail.send()   
      
    }  
    

    Thanks all for your attention =)

    0 comments No comments

0 additional answers

Sort by: Most helpful