-
-
Save joglomedia/ff1aa12e2b711adb91a3657004b5b25b to your computer and use it in GitHub Desktop.
Amazon SES mail sending script
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
#!/bin/bash | |
## ** UPDATE PER-MESSAGE ** | |
message_body=$(<message.txt) | |
subject="The Quarterly, 1st ed. 2024-06 [D85.23.13]" | |
# sender | |
sender="Johnny ‘Decimal’ Noble <[email protected]>" | |
body="$message_body" | |
########################################################### | |
region="ap-southeast-2" | |
# List of recipients, one per line. Defaults to SES mailbox simulator addresses (https://docs.aws.amazon.com/ses/latest/dg/send-an-email-from-console.html#send-email-simulator-how-to-use) | |
recipients=( | |
# always leave these tests here | |
"[email protected]" | |
"[email protected]" | |
"[email protected]" | |
# actual recipients here | |
) | |
# Send an email to each recipient | |
# Iterate through the list of recipients. | |
# Invoke the AWS SES SendEmail operation with a single recipient defined in the Destination | |
for recipient in "${recipients[@]}"; do | |
echo sending to "$recipient" | |
aws sesv2 send-email \ | |
--from-email-address "$sender" \ | |
--destination "ToAddresses=$recipient" \ | |
--content "Simple={Subject={Data='$subject',Charset='UTF-8'},Body={Text={Data='$body',Charset='UTF-8'}}}" \ | |
--region "$region" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
recipients=$(cut -d= -f1 ./recipients.txt)