Sending Custom HTML Emails with PowerShell

IT. Delinquent
4 min readJun 3, 2021

Hi Everyone,

Today I wanted to show you my preferred way of sending custom HTML emails with PowerShell. There a ton of benefits to doing it this way. One of my favourites is the fact that you can embed images into the email rather than host them on a separate website.

I hope COVID restrictions are starting to ease for you all. Still, don’t want to let your guard down too much, ey! Better safe than sorry.

This article is also available on Medium if you prefer to read over there. You can find the link here!

Why bother ‘Sending Custom HTML Emails with PowerShell’?

The main issue with using custom HTML emails, is that HTML shows differently on every single device. This can result in your emails looking different with different email applications.

Outlook is particularly bad for displaying HTML in a uniform way. It often completely ignores the header which is often used to contain styling and CSS information. So the only way I’ve found around this is to include the styling on every single HTML element in the HTML body. This is far from ideal and takes a ton of time compared to header CSS styling.

The HTML Code

You can see the HTML code I used below. This includes every item of information and styling required for the email. It’s also were we set our content.

You can see in the HTML code, that I use it to:

  1. Set the Microsoft Office product details and pixel density information (This is required for Outlook)
  2. The logo.png is loaded using the cid: prefix which looks at the loaded images
  3. The rest is just generic HTML with inline styling
<!DOCTYPE html>
<html lang="en" xmlns="" xmlns:o="urn:schemas-microsoft-com:office:office">

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="x-apple-disable-message-reformatting">
<!--[if mso]>



IT. Delinquent

IT Pro 👨‍💻 Dad 👀 Husband🔒 Let me know if you find anything I write to be useful... I'm still looking! Check out my website!