From afe005d78521d0c8b1c634620f10b47099e6d7eb Mon Sep 17 00:00:00 2001 From: idanoo Date: Mon, 14 Nov 2022 13:11:42 +1300 Subject: [PATCH] Abstract tooling --- README.md | 8 ++++++++ destination.json | 2 +- message.json | 2 +- send.sh | 16 +++++++++++++--- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2414b48 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# SES-email-blast + +Used to send bulk test emails for.. purposes + +Usage: +``` +$ bash send.sh +``` \ No newline at end of file diff --git a/destination.json b/destination.json index f6e3d9f..a0f94dd 100644 --- a/destination.json +++ b/destination.json @@ -1,5 +1,5 @@ { - "ToAddresses": ["test@test.com"], + "ToAddresses": ["REPLACE_WITH_SENDER"], "CcAddresses": [], "BccAddresses": [] } diff --git a/message.json b/message.json index 15423c6..6485408 100644 --- a/message.json +++ b/message.json @@ -1,6 +1,6 @@ { "Subject": { - "Data": "Test email sent using the AWS CLI", + "Data": "1 - Test email sent using the AWS CLI", "Charset": "UTF-8" }, "Body": { diff --git a/send.sh b/send.sh index 479bedb..5d34fd8 100644 --- a/send.sh +++ b/send.sh @@ -1,9 +1,19 @@ #!/bin/bash -PROFILE=$1 -FROM=$2 +PROFILE=$1 # which AWS profile +NUMBER=$2 # how many to send +FROM=$3 # who we sending from +TO=$4 # who we sending to -for i in {1..100} +x=1 +sed -i "s/REPLACE_WITH_SENDER/$TO/g" destination.json +echo "Sending $NUMBER messages to $TO from $FROM" +for i in $(seq 1 $NUMBER) do + sed -i "s/$x /$i /g" message.json + x=$i aws ses --region us-west-2 --profile $PROFILE send-email --from $FROM --destination file://destination.json --message file://message.json done + +sed -i "s/$TO/REPLACE_WITH_SENDER/g" destination.json +sed -i "s/$x /1 /g" message.json