Joke!

The below script is sending e-mails when someone is opening a particular excel file. The script will also one the Excel file

Add-Type -AssemblyName System.DirectoryServices.AccountManagement

$a = new-object -comobject excel.application
$a.Visible = $true
$b = $a.Workbooks.Open("\\myshare\Excel_document.xls")

$emailaddress = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity([System.DirectoryServices.AccountManagement.ContextType]::Domain,(whoami)).EmailAddress
$images = @{ 
          image1 = '\\pictureLocation\2aa2.JPG' 
          image2 = '\\pictureLocation\3aa3.JPG' 
}

$body = @' 
<html> 
      <body> 
            <img src="\\pictureLocation\2aa2.JPG"><br> 
            <img src="\\pictureLocation\3aa3.JPG"> 
       </body> 
</html> 
'@

$params = @{ 
      Body = $body

      Attachment = $images
      BodyAsHtml = $true 
      Subject = 'Joke...' 
      From = $emailaddress 
      To = 'email@address.com'
      CC = 'email@address.com' 
      SmtpServer = 'mySMTPserver' 
}

Send-MailMessage @params

The e-mail is also displaying two images.