mardi 13 octobre 2015

send raw email using AWS CLI

I need to sending email with attach two text files as "log1.txt" and log2.txt. I have destination.json that define all send email address as bellow

{
  "ToAddresses":  ["recipient1@example.com", "recipient2@example.com"],
  "CcAddresses":  ["recipient3@example.com"],
  "BccAddresses": []
}

in email body define in message.json as bellow

{
   "Data": "Subject: Test email sent using the AWS CLI (contains an attachment)\nMIME-Version: 1.0\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\n\n--NextPart\nContent-Type: text/plain\n\nThis is the message body.\n\n--NextPart\nContent-Type: text/plain;\nContent-Disposition: attachment; file://\"C:\log\SES\log.txt\"\n\n--NextPart\nContent-Type: text/plain;\nContent-Disposition: attachment; file://\"C:\log\SES\log2.txt\"\n\n--NextPart----"
}

after create above files i run bellow command in the aws cli, That not work for me.

aws ses send-raw-email --source myfrom@gmail.com --destination http://fileC:\email\SES\destination.json --message http://fileC:\email\SES\message.json

Note: i can't put to email to message.json every time email address changing so i need to keep separately. like destnation.json




Aucun commentaire:

Enregistrer un commentaire