Posts

Showing posts from February, 2017

Using an Outlook Object to send email

Greetings fellow travels. It has been a while since I have posted anything so I thought I would add a small tidbit to answer that question of "How do I send a freak'n email?" of course this version uses your MSFT Outlook client. It is very difficult, so difficult I went "That's It" and was in shock that is was actually that simple. The other caveat is that this sends the email in HTML format so you can add all your favorite HTML tags. This is a really simple version and I didn't get very deep but there is lots of things you can actually do with the email. There are several good pages on the web that go into greater detail and get more in depth (and complex). But for my needs this is more than enough. Enjoy! $Outlook = New-Object -ComObject Outlook.Application $Mail = $Outlook.CreateItem(0) $Mail.To = $Address If (!([string]::IsNullOrWhiteSpace($CCAddress))) {     $Mail.CC = $CCAddress } $Mail.Subject = $Subject $Mail.HTMLBody = $HtmlBo