Skip to content

Instantly share code, notes, and snippets.

@pkskelly
Created December 2, 2015 20:30
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save pkskelly/0b16f9892234e88c50c3 to your computer and use it in GitHub Desktop.
Save pkskelly/0b16f9892234e88c50c3 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 = "admin@acme.com"
$EmailTo = "user@acme.com"
$Subject = "SendGrid test"
$Body = "SendGrid testing successful"
Send-MailMessage -smtpServer $SMTPServer -Credential $credential -Usessl -Port 587 -from $EmailFrom -to $EmailTo -subject $Subject -Body $Body
@projectje
Copy link

The operation has timed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment