Sunday, July 10, 2016

TIP - Send HTML Email with embedded Image

In this post, I am sharing a nice little tip to send HTML email with embedded. We have seen in the past how easy it is to create HTML body using Word & than send it thru powershell script.

Refer: https://gallery.technet.microsoft.com/scriptcenter/Send-HTML-Email-Powershell-6653235c

You can just use Microsoft word , Create your content & save it as HTML.(webpage, filtered)

html

After that just using get-content & sending it as email.

Things get a bit trickier when you want to embed the image as it creates separate directory files for it & get-content will not pick it up.(example:)

html1

See below separate directory to store image gets created, so when we send email using get content, cross (X) appears & image is not displayed.

Capture1

To counter this just upload the image file on intranet or url that is accessible, edit the HTML file using notepad & add below line.

<img src="http://intranet/sites/image.jpg">

Capture2

Now there would not be any separate directory & image will be downloaded from the url you mentioned, this can be used in get-content & send company specific HTML emails that contains company logos or other images.

There might be other methods too but this one I find it too simple for admins as we dont write HTML codes :).

Regards

Sukhija Vikas

http://msexchange.me

No comments:

Post a Comment