Created
December 13, 2019 15:37
-
-
Save oliveratgithub/a2c02322b378e43652bef6c4ee7c964f to your computer and use it in GitHub Desktop.
SMTP test email using AWS Simple Email Service (SES) on UNIX openssl s_client or Windows PowerShell
This file contains 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
# Source: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp-client-command-line.html | |
# X-SES-CONFIGURATION-SET is optional | |
EHLO yourdomain.com | |
AUTH LOGIN | |
base64 encoded Smtp Username | |
base64 encoded Smtp Password | |
MAIL FROM: [email protected] | |
RCPT TO: [email protected] | |
DATA | |
#X-SES-CONFIGURATION-SET: YourSESConfigSet | |
From: Your Nice Name <[email protected]> | |
To: [email protected] | |
Cc: [email protected] | |
Bcc: [email protected] | |
Subject: Hello from Amazon SES SMTP Test for UNIX | |
This message was sent using the Amazon SES SMTP interface. | |
There is no more content in this test email. | |
. | |
QUIT |
This file contains 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
# Change 'eu-west-1' according to your AWS SES SMTP setup! | |
# Explicit SSL over port 587 | |
$ openssl s_client -crlf -quiet -starttls smtp -connect email-smtp.eu-west-1.amazonaws.com:587 < unix-aws-ses-testmail.txt | |
# Implicit SSL over port 465 | |
$ openssl s_client -crlf -quiet -connect email-smtp.us-west-2.amazonaws.com:465 < unix-aws-ses-testmail.txt |
This file contains 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
<# Source: | |
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp-client-command-line.html | |
#> | |
$EmailFrom = "[email protected]" | |
$EmailTo = "[email protected]" | |
$Subject = "Hello from Amazon SES SMTP Test for Windows" | |
$Body = "This message was sent using the Amazon SES SMTP interface. There is no more content in this test email." | |
$SMTPServer = "email-smtp.eu-west-1.amazonaws.com" # Change 'eu-west-1' according to your AWS SES SMTP setup! | |
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) | |
$SMTPClient.EnableSsl = $true | |
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("base64 encoded Smtp Username", "base64 encoded Smtp Password"); | |
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body) | |
Remove-Variable -Name SMTPClient |
This file contains 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
# Requires that "Set-ExecutionPolicy RemoteSigned" has been set in Windows PowerShell | |
> powershell.exe C:\PATH\TO\windows-aws-ses-testmail.ps1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry, is here an updated version of this script for powershell ses-smtp test?
Thanks for this hard work.