DEV Community

Yasuhiro Matsuda for AWS Community Builders

Posted on

Send mail by SES CLI

aws ses send-email --from "from address" --to "to address" --subject "subject" --text "mail body"

You need aws ses send-raw-email command when you change mail header, but you need base64 encoding otherwise raise Invalid base64.

I try make sample because public document have not sample.

You need below json file (named message.txt).

"Data": "From: (from address)\nTo: (Delivered-To header)\nSubject: (subject)\n\n(mail body)"
Enter fullscreen mode Exit fullscreen mode

You run below command.You need --source "source address" option when you don't contain source address into message.txt otherwise occur error "An error occurred (InvalidParameterValue) when calling the SendRawEmail operation: Missing required header 'From'."

aws ses send-raw-email --destinations "from address1" "from address2" --cli-binary-format raw-in-base64-out --raw-message file://message.txt

Top comments (0)