Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 我无法将图像从桌面位置插入或粘贴到outlook邮件正文_Powershell_Powershell 2.0_Powershell 3.0_Powershell 4.0 - Fatal编程技术网

Powershell 我无法将图像从桌面位置插入或粘贴到outlook邮件正文

Powershell 我无法将图像从桌面位置插入或粘贴到outlook邮件正文,powershell,powershell-2.0,powershell-3.0,powershell-4.0,Powershell,Powershell 2.0,Powershell 3.0,Powershell 4.0,我正在尝试通过将桌面上的图像插入outlook邮件正文 powershell脚本,包含以下脚本邮件正在发送,但图像未发送 邮件正文。请检查并告诉我哪里做错了。请注意我 不要图片作为附件,我希望它在邮件正文。请帮助它将 真的很可观。 下面是powershell脚本 $file1 = "C:\Users\rony\Desktop\screenshot.png" sleep 02 $Outlook = New-Object -ComObject Outlook.Applicat

我正在尝试通过将桌面上的图像插入outlook邮件正文 powershell脚本,包含以下脚本邮件正在发送,但图像未发送 邮件正文。请检查并告诉我哪里做错了。请注意我 不要图片作为附件,我希望它在邮件正文。请帮助它将 真的很可观。 下面是powershell脚本

    $file1 = "C:\Users\rony\Desktop\screenshot.png"
    sleep 02
    $Outlook = New-Object -ComObject Outlook.Application
    $Mail = $Outlook.CreateItem(0)
    $Mail.To = "rony7@gmail.com"
    $Mail.Subject = "screenshot status"
    $Mail.HTMLBody =  @"
    <html>
    <body>
       Hi ,
    <p>Please find the below screenshots of status.
       <p>
       <img src="cid:image1.png">

       <p>Thank you!

       </body>
       </html>
    "@
    $attachment = New-Object System.Net.Mail.Attachment($file1)
    $attachment.ContentDisposition.Inline = $True
    $attachment.ContentDisposition.DispositionType = "Inline"
    $attachment.ContentType.MediaType = "image/png"
    $attachment.ContentId = 'image1.png'
    $Mail.Attachments.Add($attachment)
    sleep 05
    $Mail.Send()
$file1=“C:\Users\rony\Desktop\screenshot.png”
睡眠02
$Outlook=新对象-ComObject Outlook.Application
$Mail=$Outlook.CreateItem(0)
$Mail.To=”rony7@gmail.com"
$Mail.Subject=“屏幕截图状态”
$Mail.HTMLBody=@”
你好
请查看以下状态截图。

谢谢大家!!
"@
$attachment=新对象System.Net.Mail.attachment($file1)
$attachment.ContentDisposition.Inline=$True
$attachment.ContentDisposition.DispositionType=“Inline”
$attachment.ContentType.MediaType=“image/png”
$attachment.ContentId='image1.png'
$Mail.Attachments.Add($attachment)
睡眠05
$Mail.Send()

看看这篇博文嗨,我已经检查并创建了上面的脚本,但没有在邮件正文中反映的图像。请检查上述脚本一次,并让我知道我所犯的错误。您使用的是哪个outlook版本?outlook版本是2013