Skip to content

Instantly share code, notes, and snippets.

@ml4den
Created December 23, 2016 12:05
Show Gist options
  • Save ml4den/791f857d74c943b83988abde9367682c to your computer and use it in GitHub Desktop.
Save ml4den/791f857d74c943b83988abde9367682c to your computer and use it in GitHub Desktop.
Powershell: Send HTML Email Function
function SendEmail {
param([string]$emailSubject, [string]$emailBody)
$recipientEmail = "[email protected]"
$senderName = "John Smith"
$senderEmail = "[email protected]"
$serverSMTP = "mail.example.com"
Send-MailMessage -To $recipientEmail -From "$senderName <$senderEmail>" -Subject $emailSubject -Body $emailBody -BodyAsHtml -SmtpServer $serverSMTP
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment