Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . ses ]

send-email

Description

Composes an email message and immediately queues it for sending. In order to send email using the send-email operation, your message must meet the following requirements:

  • The message must be sent from a verified email address or domain. If you attempt to send email using a non-verified address or domain, the operation will result in an "Email address not verified" error.
  • If your account is still in the Amazon SES sandbox, you may only send to verified addresses or domains, or to email addresses associated with the Amazon SES Mailbox Simulator. For more information, see Verifying Email Addresses and Domains in the Amazon SES Developer Guide.
  • The total size of the message, including attachments, must be smaller than 10 MB.
  • The message must include at least one recipient email address. The recipient address can be a To: address, a CC: address, or a BCC: address. If a recipient email address is invalid (that is, it is not in the format UserName@[SubDomain.]Domain.TopLevelDomain ), the entire message will be rejected, even if the message contains other recipients that are valid.
  • The message may not include more than 50 recipients, across the To:, CC: and BCC: fields. If you need to send an email message to a larger audience, you can divide your recipient list into groups of 50 or fewer, and then call the send-email operation several times to send the message to each group.

Warning

For every message that you send, the total number of recipients (including each recipient in the To:, CC: and BCC: fields) is counted against the maximum number of emails you can send in a 24-hour period (your sending quota ). For more information about sending quotas in Amazon SES, see Managing Your Amazon SES Sending Limits in the Amazon SES Developer Guide.

See also: AWS API Documentation

Synopsis

  send-email
[--destination <value>]
[--message <value>]
[--reply-to-addresses <value>]
[--return-path <value>]
[--source-arn <value>]
[--return-path-arn <value>]
[--tags <value>]
[--configuration-set-name <value>]
--from <value>
[--to <value>]
[--cc <value>]
[--bcc <value>]
[--subject <value>]
[--text <value>]
[--html <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--destination (structure)

The destination for this email, composed of To:, CC:, and BCC: fields.

Shorthand Syntax:

ToAddresses=string,string,CcAddresses=string,string,BccAddresses=string,string

JSON Syntax:

{
  "ToAddresses": ["string", ...],
  "CcAddresses": ["string", ...],
  "BccAddresses": ["string", ...]
}

--message (structure)

The message to be sent.

Shorthand Syntax:

Subject={Data=string,Charset=string},Body={Text={Data=string,Charset=string},Html={Data=string,Charset=string}}

JSON Syntax:

{
  "Subject": {
    "Data": "string",
    "Charset": "string"
  },
  "Body": {
    "Text": {
      "Data": "string",
      "Charset": "string"
    },
    "Html": {
      "Data": "string",
      "Charset": "string"
    }
  }
}

--reply-to-addresses (list)

The reply-to email address(es) for the message. If the recipient replies to the message, each reply-to address will receive the reply.

Syntax:

"string" "string" ...

--return-path (string)

The email address that bounces and complaints will be forwarded to when feedback forwarding is enabled. If the message cannot be delivered to the recipient, then an error message will be returned from the recipient's ISP; this message will then be forwarded to the email address specified by the ReturnPath parameter. The ReturnPath parameter is never overwritten. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES.

--source-arn (string)

This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter.

For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to send from user@example.com , then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the Source to be user@example.com .

For more information about sending authorization, see the Amazon SES Developer Guide .

--return-path-arn (string)

This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter.

For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to use feedback@example.com , then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the ReturnPath to be feedback@example.com .

For more information about sending authorization, see the Amazon SES Developer Guide .

--tags (list)

A list of tags, in the form of name/value pairs, to apply to an email that you send using send-email . Tags correspond to characteristics of the email that you define, so that you can publish email sending events.

Shorthand Syntax:

Name=string,Value=string ...

JSON Syntax:

[
  {
    "Name": "string",
    "Value": "string"
  }
  ...
]

--configuration-set-name (string)

The name of the configuration set to use when you send an email using send-email .

--from (string)

The email address that is sending the email. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES. For information about verifying identities, see the Amazon SES Developer Guide .

If you are sending on behalf of another user and have been permitted to do so by a sending authorization policy, then you must also specify the SourceArn parameter. For more information about sending authorization, see the Amazon SES Developer Guide .

In all cases, the email address must be 7-bit ASCII. If the text must contain any other characters, then you must use MIME encoded-word syntax (RFC 2047) instead of a literal string. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?= . For more information, see RFC 2047 .

--to (string) The email addresses of the primary recipients. You can specify multiple recipients as space-separated values

--cc (string) The email addresses of copy recipients (Cc). You can specify multiple recipients as space-separated values

--bcc (string) The email addresses of blind-carbon-copy recipients (Bcc). You can specify multiple recipients as space-separated values

--subject (string) The subject of the message

--text (string) The raw text body of the message

--html (string) The HTML body of the message

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

Examples

To send a formatted email using Amazon SES

The following example uses the send-email command to send a formatted email:

aws ses send-email --from sender@example.com --destination file://c:\temp\destination.json --message file://c:\temp\message.json

Output:

{
   "MessageId": "EXAMPLEf3a5efcd1-51adec81-d2a4-4e3f-9fe2-5d85c1b23783-000000"
}

The destination and the message are JSON data structures saved in .json files in a directory called c:\temp. These files are as follows:

destination.json:

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

message.json:

{
   "Subject": {
       "Data": "Test email sent using the AWS CLI",
       "Charset": "UTF-8"
   },
   "Body": {
       "Text": {
           "Data": "This is the message body in text format.",
           "Charset": "UTF-8"
       },
       "Html": {
           "Data": "This message body contains HTML formatting. It can, for example, contain links like this one: <a class=\"ulink\" href=\"http://docs.aws.amazon.com/ses/latest/DeveloperGuide\" target=\"_blank\">Amazon SES Developer Guide</a>.",
           "Charset": "UTF-8"
       }
   }
}

Replace the sender and recipient email addresses with the ones you want to use. Note that the sender's email address must be verified with Amazon SES. Until you are granted production access to Amazon SES, you must also verify the email address of each recipient unless the recipient is the Amazon SES mailbox simulator. For more information on verification, see Verifying Email Addresses and Domains in Amazon SES in the Amazon Simple Email Service Developer Guide.

The Message ID in the output indicates that the call to send-email was successful.

If you don't receive the email, check your Junk box.

For more information on sending formatted email, see Sending Formatted Email Using the Amazon SES API in the Amazon Simple Email Service Developer Guide.

Output

MessageId -> (string)

The unique message identifier returned from the send-email action.