Skip to content Skip to sidebar Skip to footer

Embed Image In Email Using Outlook Object In Powershell

I already posted a question related to this (HTML embedded image in the email not displayed ) and updated my script to include cid, but now my images are attached rather than comin

Solution 1:

You will need to set the PR_ATTACH_CONTENT_ID property to the matching value of the cid attribute (Volume.png in your case):

$attach = $mail.Attachments.Add($attachment)
$attach.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F", "Volume.png")

Solution 2:

Updated and Complete Answer incase if anyone needs :

$Text = "<br /><font face='Arial'><b><i>For Full Interactive Viewing <a 
href=http://www.google.com>Click Here</a></i></b></font><br/>"$MessageImages = "<br/><img src='C:\Users\E5559405\Desktop\IT\Image.jpg'/><br/>"$FinalText = $Text+$MessageImages$o = New-Object -ComObject Outlook.Application

$mail = $o.CreateItem(0)

$mail.importance = 2$mail.subject = “Reports - Automated Email from user list$mail.HTMLBody = $FinalText$mail.To = "xyz@gmail.com"$mail.Send()

Post a Comment for "Embed Image In Email Using Outlook Object In Powershell"