Problem:
How do you test the AWS SES service using PowerShell?
Solution:
The below script will ask you for all the relevant details and then send a test mail using AWS SES. You may need to change your availability zone.
Add-Type -AssemblyName Microsoft.VisualBasic $AWS_ACCESS_KEY = [Microsoft.VisualBasic.Interaction]::InputBox('Enter AWS Access Key', 'AWS Access Key') $AWS_SECRET_KEY = [Microsoft.VisualBasic.Interaction]::InputBox('Enter AWS Secret Key', 'AWS Secret Key') $SECURE_KEY = $(ConvertTo-SecureString -AsPlainText -String $AWS_SECRET_KEY -Force) $creds = $(New-Object System.Management.Automation.PSCredential ($AWS_ACCESS_KEY, $SECURE_KEY)) $from = [Microsoft.VisualBasic.Interaction]::InputBox('Enter from address', 'From Address') $to = [Microsoft.VisualBasic.Interaction]::InputBox('Enter to address', 'To Address') $subject = "Test message " $smtpserver ="email-smtp.eu-west-1.amazonaws.com" $body = "test email" Write-Host "Sending Email via AmazonSES" Send-MailMessage -From $from -To $to -Subject $subject -Body $body -SmtpServer $smtpserver -Credential $creds -UseSsl -Port 587 Write-Host "Sent"