Skip to content

Instantly share code, notes, and snippets.

@mnjstwins
Forked from pkskelly/Send-SendGridMessage.ps1
Created February 8, 2018 19:27
Show Gist options
  • Save mnjstwins/491ec8ad0145ce38b813700cf4b69998 to your computer and use it in GitHub Desktop.
Save mnjstwins/491ec8ad0145ce38b813700cf4b69998 to your computer and use it in GitHub Desktop.
Sending Email from PowerShell using SendGrid (in Azure)
$Username ="azure_*********@azure.com"
$Password = ConvertTo-SecureString "********" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $Username, $Password
$SMTPServer = "smtp.sendgrid.net"
$EmailFrom = "[email protected]"
$EmailTo = "[email protected]"
$Subject = "SendGrid test"
$Body = "SendGrid testing successful"
Send-MailMessage -smtpServer $SMTPServer -Credential $credential -Usessl -Port 587 -from $EmailFrom -to $EmailTo -subject $Subject -Body $Body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment