Skip to content Skip to sidebar Skip to footer

Html Embedded Image In The Email Not Displayed

This is the first time I am writing power shell scripting, I am trying to automatically send email reports to our users. I am creating outlook object and trying to use it. $Text -

Solution 1:

If u need to send the HTML report with images in email, u have to attach the images with that email. Refer the below one,

$files = Get-ChildItem C:\MyImages\             
Foreach($file in $files)                   
{                     
$filename = $file.FullName                    
$attachment = New-Object System.Net.Mail.Attachment –ArgumentList  
$filename.ToString()         
$attachment.ContentDisposition.Inline = $True$attachment.ContentDisposition.DispositionType = "Inline"$attachment.ContentType.MediaType = "image/jpg"$attachment.ContentId = $file.ToString()          
$emailMessage.Attachments.Add($attachment)         
}         
$SMTPClient.Send($emailMessage)        
$attachment.Dispose();           
$emailMessage.Dispose();         

In the HTML mention the image source as img src="cid:Volume.png" and img src='cid:Value.png'

Try it'll works

Post a Comment for "Html Embedded Image In The Email Not Displayed"