Powershell Send Email With Images
<p>I am  trying to embed an image into an email to be sent out via Powershell.</p>

<p>Below is the code I have:</p>

<pre class="lang-powershell prettyprint-override"><code>$Attachment = New-Object Net.Mail.Attachment($LocalLocation)
$Attachment.ContentDisposition.Inline = $True
$Attachment.ContentDisposition.DispositionType = "Inline"
$Attachment.ContentType.MediaType = "image/png"


$MailMessage = New-Object Net.Mail.MailMessage
$MailMessage.To.Add($emailTo)
$MailMessage.From = $MyEmail
$MailMessage.Subject = "Test Email"
$MailMessage.IsBodyHtml = $True
$MailMessage.Attachments.Add($Attachment)

$MailMessage.Body = "
  &lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;
      &lt;img src='CID:$($Attachment.ContentId)' /&gt;
    &lt;/body&gt;
  &lt;/html&gt;"

$SmtpClient = New-Object Net.Mail.SmtpClient("123.0.0.1",25 )
$SmtpClient.Send($MailMessage)
</code></pre>

<p>
I get sent an email but there is just an empty box in the message. The $LocalLocation is the link to my image. </p>

<p>I am using Powershell 3</p>