Skip to content

Instantly share code, notes, and snippets.

@DevOps-Dad
Created February 6, 2019 16:54
Show Gist options
  • Select an option

  • Save DevOps-Dad/1de40c85dc94b750cbdb4de902b51e08 to your computer and use it in GitHub Desktop.

Select an option

Save DevOps-Dad/1de40c85dc94b750cbdb4de902b51e08 to your computer and use it in GitHub Desktop.
Powershell Send-MailMessage to AWS SES
$AWS_ACCESS_KEY = "RealAccessKeyRightHere"
$AWS_SECRET_KEY = "TotallyRealSecretKeyRightHere"
$SECURE_KEY = $(ConvertTo-SecureString -AsPlainText -String $AWS_SECRET_KEY -Force)
$creds = $(New-Object System.Management.Automation.PSCredential ($AWS_ACCESS_KEY, $SECURE_KEY))
$from = "[email protected]"
$to = "[email protected]"
$subject = "Test SES Message"
$body = "Just testing that my AWS SES parameters are correct"
Write-Host "Sending Email via AmazonSES"
Send-MailMessage -From $from -To $to -Subject $subject -Body $body -SmtpServer email-smtp.us-east-1.amazonaws.com -Credential $creds -UseSsl -Port 587
Write-Host "Sent"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment