DEV Community

Yasuhiro Matsuda for AWS Community Builders

Posted on

2

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)

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post