{"id":1376,"date":"2022-06-21T12:00:36","date_gmt":"2022-06-21T17:00:36","guid":{"rendered":"https:\/\/zewwy.ca\/?p=1376"},"modified":"2022-06-21T12:00:36","modified_gmt":"2022-06-21T17:00:36","slug":"send-an-email-using-powershell","status":"publish","type":"post","link":"https:\/\/zewwy.ca\/index.php\/2022\/06\/21\/send-an-email-using-powershell\/","title":{"rendered":"Send an Email using Powershell"},"content":{"rendered":"<p>Source: <a href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.utility\/send-mailmessage?view=powershell-7.2\">Send-MailMessage (Microsoft.PowerShell.Utility) &#8211; PowerShell | Microsoft Docs<\/a><\/p>\n<p>Build your object&#8230;.<\/p>\n<pre>$mailParams = @{\r\nSmtpServer = 'heimdall.dgcm.ca'\r\nPort = 25\r\nUseSSL = $false\r\nFrom = 'notifications@dgcm.ca'\r\nTo = 'nos_rulz@msn.com'\r\nSubject = ('ON-PREM SMTP Relay - ' + (Get-Date -Format g))\r\nBody = 'This is a test email using ON-PREM SMTP Relay'\r\nDeliveryNotificationOption = 'OnFailure', 'OnSuccess'\r\n}<\/pre>\n<p>And then send it&#8230;.<\/p>\n<pre>Send-MailMessage $mailParams<\/pre>\n<p>if there&#8217;s any pre-reqs required I&#8217;ll update this blog post. That should be it though. Easy Peasy Lemon Squeezy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: Send-MailMessage (Microsoft.PowerShell.Utility) &#8211; PowerShell | Microsoft Docs Build your object&#8230;. $mailParams = @{ SmtpServer = &#8216;heimdall.dgcm.ca&#8217; Port = 25 UseSSL = $false From = &#8216;notifications@dgcm.ca&#8217; To = &#8216;nos_rulz@msn.com&#8217; Subject = (&#8216;ON-PREM SMTP Relay &#8211; &#8216; + (Get-Date -Format g)) Body = &#8216;This is a test email using ON-PREM SMTP Relay&#8217; DeliveryNotificationOption = &#8216;OnFailure&#8217;, &#8216;OnSuccess&#8217; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zewwy.ca\/index.php\/2022\/06\/21\/send-an-email-using-powershell\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Send an Email using Powershell&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","footnotes":""},"categories":[36,12,8],"tags":[],"class_list":["post-1376","post","type-post","status-publish","format-standard","hentry","category-exchange","category-powershell","category-server-administration"],"_links":{"self":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/1376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/comments?post=1376"}],"version-history":[{"count":1,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/1376\/revisions"}],"predecessor-version":[{"id":1377,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/1376\/revisions\/1377"}],"wp:attachment":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/media?parent=1376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/categories?post=1376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/tags?post=1376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}