We use the Amazon SES basically to configure our commercial mailers for promotions and marketing.
Considering your Amazon SES is configured in 4 regions for the same mailer and you have gotten it out of sandbox mode, and if you want to test mailers from all these locations, how will you do ?
I created a solution for the same, i would like to share the script with procedure keeping it short and sweet. We need the following 2 scripts
- convercreds.sh
#!/bin/bash
echo -n "$1" | openssl enc -base64
echo -n "$2" | openssl enc -base64
- input.txt
EHLO mailer.<domain>.com
AUTH LOGIN
<base64-key>
<base64-secret>
MAIL FROM: <user>@mailer.<domain>.com
RCPT TO: <any_of_you_email_id_to_test>@<mailer>.com
DATA
From: <User> Mailer <user@mailer.<domain>.com>
To: <any_of_you_email_id_to_test>@<mailer>.com
Subject: Amazon SES SMTP Test (<Region> Activated)
This message was sent using the Amazon SES SMTP interface (<Region>).
.
QUIT
- First run ./convercreds.sh <Amazon SES key> <Amazon SES Secret>
- Now you will get <base-64 – key> and <base64 – secret>, paste these values in input.txt
- Now replace all the ‘<>’ fields in the input.txt i have mentioned above with your values.
- Now run the following command
openssl s_client -crlf -quiet -starttls smtp -connect email-smtp.<region>.amazonaws.com:587 < input.txt
- Replace <region> every time you want to test any new region.
- Also ensure when ever you change the region, you also create a new base64 credentials out of key and secret for that region account.
- Try this out and let me know if any queries.