Created
December 23, 2016 12:05
-
-
Save ml4den/791f857d74c943b83988abde9367682c to your computer and use it in GitHub Desktop.
Powershell: Send HTML Email Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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