Amazon Pinpoint Email Service

2019/10/07 - Amazon Pinpoint Email Service - 2 updated api methods

Changes  This release of the Amazon Pinpoint Email API introduces support for using and managing message templates.

CreateDeliverabilityTestReport (updated) Link ¶
Changes (request)
{'Content': {'Template': {'TemplateArn': 'string', 'TemplateData': 'string'}}}

Create a new predictive inbox placement test. Predictive inbox placement tests can help you predict how your messages will be handled by various email providers around the world. When you perform a predictive inbox placement test, you provide a sample message that contains the content that you plan to send to your customers. Amazon Pinpoint then sends that message to special email addresses spread across several major email providers. After about 24 hours, the test is complete, and you can use the GetDeliverabilityTestReport operation to view the results of the test.

See also: AWS API Documentation

Request Syntax

client.create_deliverability_test_report(
    ReportName='string',
    FromEmailAddress='string',
    Content={
        'Simple': {
            'Subject': {
                'Data': 'string',
                'Charset': 'string'
            },
            'Body': {
                'Text': {
                    'Data': 'string',
                    'Charset': 'string'
                },
                'Html': {
                    'Data': 'string',
                    'Charset': 'string'
                }
            }
        },
        'Raw': {
            'Data': b'bytes'
        },
        'Template': {
            'TemplateArn': 'string',
            'TemplateData': 'string'
        }
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type ReportName

string

param ReportName

A unique name that helps you to identify the predictive inbox placement test when you retrieve the results.

type FromEmailAddress

string

param FromEmailAddress

[REQUIRED]

The email address that the predictive inbox placement test email was sent from.

type Content

dict

param Content

[REQUIRED]

The HTML body of the message that you sent when you performed the predictive inbox placement test.

  • Simple (dict) --

    The simple email message. The message consists of a subject and a message body.

    • Subject (dict) -- [REQUIRED]

      The subject line of the email. The subject line can only contain 7-bit ASCII characters. However, you can specify non-ASCII characters in the subject line by using encoded-word syntax, as described in RFC 2047.

      • Data (string) -- [REQUIRED]

        The content of the message itself.

      • Charset (string) --

        The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify UTF-8 , ISO-8859-1 , or Shift_JIS .

    • Body (dict) -- [REQUIRED]

      The body of the message. You can specify an HTML version of the message, a text-only version of the message, or both.

      • Text (dict) --

        An object that represents the version of the message that is displayed in email clients that don't support HTML, or clients where the recipient has disabled HTML rendering.

        • Data (string) -- [REQUIRED]

          The content of the message itself.

        • Charset (string) --

          The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify UTF-8 , ISO-8859-1 , or Shift_JIS .

      • Html (dict) --

        An object that represents the version of the message that is displayed in email clients that support HTML. HTML messages can include formatted text, hyperlinks, images, and more.

        • Data (string) -- [REQUIRED]

          The content of the message itself.

        • Charset (string) --

          The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify UTF-8 , ISO-8859-1 , or Shift_JIS .

  • Raw (dict) --

    The raw email message. The message has to meet the following criteria:

    • The message has to contain a header and a body, separated by one blank line.

    • All of the required header fields must be present in the message.

    • Each part of a multipart MIME message must be formatted properly.

    • If you include attachments, they must be in a file format that Amazon Pinpoint supports.

    • The entire message must be Base64 encoded.

    • If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, you should encode that content to ensure that recipients' email clients render the message properly.

    • The length of any single line of text in the message can't exceed 1,000 characters. This restriction is defined in RFC 5321.

    • Data (bytes) -- [REQUIRED]

      The raw email message. The message has to meet the following criteria:

      • The message has to contain a header and a body, separated by one blank line.

      • All of the required header fields must be present in the message.

      • Each part of a multipart MIME message must be formatted properly.

      • Attachments must be in a file format that Amazon Pinpoint supports.

      • The entire message must be Base64 encoded.

      • If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, you should encode that content to ensure that recipients' email clients render the message properly.

      • The length of any single line of text in the message can't exceed 1,000 characters. This restriction is defined in RFC 5321.

  • Template (dict) --

    The template to use for the email message.

    • TemplateArn (string) --

      The Amazon Resource Name (ARN) of the template.

    • TemplateData (string) --

      An object that defines the values to use for message variables in the template. This object is a set of key-value pairs. Each key defines a message variable in the template. The corresponding value defines the value to use for that variable.

type Tags

list

param Tags

An array of objects that define the tags (keys and values) that you want to associate with the predictive inbox placement test.

  • (dict) --

    An object that defines the tags that are associated with a resource. A tag is a label that you optionally define and associate with a resource in Amazon Pinpoint. Tags can help you categorize and manage resources in different ways, such as by purpose, owner, environment, or other criteria. A resource can have as many as 50 tags.

    Each tag consists of a required tag key and an associated tag value , both of which you define. A tag key is a general label that acts as a category for a more specific tag value. A tag value acts as a descriptor within a tag key. A tag key can contain as many as 128 characters. A tag value can contain as many as 256 characters. The characters can be Unicode letters, digits, white space, or one of the following symbols: _ . : / = + -. The following additional restrictions apply to tags:

    • Tag keys and values are case sensitive.

    • For each associated resource, each tag key must be unique and it can have only one value.

    • The aws: prefix is reserved for use by AWS; you can’t use it in any tag keys or values that you define. In addition, you can't edit or remove tag keys or values that use this prefix. Tags that use this prefix don’t count against the limit of 50 tags per resource.

    • You can associate tags with public or shared resources, but the tags are available only for your AWS account, not any other accounts that share the resource. In addition, the tags are available only for resources that are located in the specified AWS Region for your AWS account.

    • Key (string) -- [REQUIRED]

      One part of a key-value pair that defines a tag. The maximum length of a tag key is 128 characters. The minimum length is 1 character.

    • Value (string) -- [REQUIRED]

      The optional part of a key-value pair that defines a tag. The maximum length of a tag value is 256 characters. The minimum length is 0 characters. If you don’t want a resource to have a specific tag value, don’t specify a value for this parameter. Amazon Pinpoint will set the value to an empty string.

rtype

dict

returns

Response Syntax

{
    'ReportId': 'string',
    'DeliverabilityTestStatus': 'IN_PROGRESS'|'COMPLETED'
}

Response Structure

  • (dict) --

    Information about the predictive inbox placement test that you created.

    • ReportId (string) --

      A unique string that identifies the predictive inbox placement test.

    • DeliverabilityTestStatus (string) --

      The status of the predictive inbox placement test. If the status is IN_PROGRESS , then the predictive inbox placement test is currently running. Predictive inbox placement tests are usually complete within 24 hours of creating the test. If the status is COMPLETE , then the test is finished, and you can use the GetDeliverabilityTestReport to view the results of the test.

SendEmail (updated) Link ¶
Changes (request)
{'Content': {'Template': {'TemplateArn': 'string', 'TemplateData': 'string'}}}

Sends an email message. You can use the Amazon Pinpoint Email API to send two types of messages:

  • Simple – A standard email message. When you create this type of message, you specify the sender, the recipient, and the message body, and Amazon Pinpoint assembles the message for you.

  • Raw – A raw, MIME-formatted email message. When you send this type of email, you have to specify all of the message headers, as well as the message body. You can use this message type to send messages that contain attachments. The message that you specify has to be a valid MIME message.

See also: AWS API Documentation

Request Syntax

client.send_email(
    FromEmailAddress='string',
    Destination={
        'ToAddresses': [
            'string',
        ],
        'CcAddresses': [
            'string',
        ],
        'BccAddresses': [
            'string',
        ]
    },
    ReplyToAddresses=[
        'string',
    ],
    FeedbackForwardingEmailAddress='string',
    Content={
        'Simple': {
            'Subject': {
                'Data': 'string',
                'Charset': 'string'
            },
            'Body': {
                'Text': {
                    'Data': 'string',
                    'Charset': 'string'
                },
                'Html': {
                    'Data': 'string',
                    'Charset': 'string'
                }
            }
        },
        'Raw': {
            'Data': b'bytes'
        },
        'Template': {
            'TemplateArn': 'string',
            'TemplateData': 'string'
        }
    },
    EmailTags=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    ConfigurationSetName='string'
)
type FromEmailAddress

string

param FromEmailAddress

The email address that you want to use as the "From" address for the email. The address that you specify has to be verified.

type Destination

dict

param Destination

[REQUIRED]

An object that contains the recipients of the email message.

  • ToAddresses (list) --

    An array that contains the email addresses of the "To" recipients for the email.

    • (string) --

  • CcAddresses (list) --

    An array that contains the email addresses of the "CC" (carbon copy) recipients for the email.

    • (string) --

  • BccAddresses (list) --

    An array that contains the email addresses of the "BCC" (blind carbon copy) recipients for the email.

    • (string) --

type ReplyToAddresses

list

param ReplyToAddresses

The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.

  • (string) --

type FeedbackForwardingEmailAddress

string

param FeedbackForwardingEmailAddress

The address that Amazon Pinpoint should send bounce and complaint notifications to.

type Content

dict

param Content

[REQUIRED]

An object that contains the body of the message. You can send either a Simple message or a Raw message.

  • Simple (dict) --

    The simple email message. The message consists of a subject and a message body.

    • Subject (dict) -- [REQUIRED]

      The subject line of the email. The subject line can only contain 7-bit ASCII characters. However, you can specify non-ASCII characters in the subject line by using encoded-word syntax, as described in RFC 2047.

      • Data (string) -- [REQUIRED]

        The content of the message itself.

      • Charset (string) --

        The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify UTF-8 , ISO-8859-1 , or Shift_JIS .

    • Body (dict) -- [REQUIRED]

      The body of the message. You can specify an HTML version of the message, a text-only version of the message, or both.

      • Text (dict) --

        An object that represents the version of the message that is displayed in email clients that don't support HTML, or clients where the recipient has disabled HTML rendering.

        • Data (string) -- [REQUIRED]

          The content of the message itself.

        • Charset (string) --

          The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify UTF-8 , ISO-8859-1 , or Shift_JIS .

      • Html (dict) --

        An object that represents the version of the message that is displayed in email clients that support HTML. HTML messages can include formatted text, hyperlinks, images, and more.

        • Data (string) -- [REQUIRED]

          The content of the message itself.

        • Charset (string) --

          The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify UTF-8 , ISO-8859-1 , or Shift_JIS .

  • Raw (dict) --

    The raw email message. The message has to meet the following criteria:

    • The message has to contain a header and a body, separated by one blank line.

    • All of the required header fields must be present in the message.

    • Each part of a multipart MIME message must be formatted properly.

    • If you include attachments, they must be in a file format that Amazon Pinpoint supports.

    • The entire message must be Base64 encoded.

    • If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, you should encode that content to ensure that recipients' email clients render the message properly.

    • The length of any single line of text in the message can't exceed 1,000 characters. This restriction is defined in RFC 5321.

    • Data (bytes) -- [REQUIRED]

      The raw email message. The message has to meet the following criteria:

      • The message has to contain a header and a body, separated by one blank line.

      • All of the required header fields must be present in the message.

      • Each part of a multipart MIME message must be formatted properly.

      • Attachments must be in a file format that Amazon Pinpoint supports.

      • The entire message must be Base64 encoded.

      • If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, you should encode that content to ensure that recipients' email clients render the message properly.

      • The length of any single line of text in the message can't exceed 1,000 characters. This restriction is defined in RFC 5321.

  • Template (dict) --

    The template to use for the email message.

    • TemplateArn (string) --

      The Amazon Resource Name (ARN) of the template.

    • TemplateData (string) --

      An object that defines the values to use for message variables in the template. This object is a set of key-value pairs. Each key defines a message variable in the template. The corresponding value defines the value to use for that variable.

type EmailTags

list

param EmailTags

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

  • (dict) --

    Contains the name and value of a tag that you apply to an email. You can use message tags when you publish email sending events.

    • Name (string) -- [REQUIRED]

      The name of the message tag. The message tag name has to meet the following criteria:

      • It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-).

      • It can contain no more than 256 characters.

    • Value (string) -- [REQUIRED]

      The value of the message tag. The message tag value has to meet the following criteria:

      • It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-).

      • It can contain no more than 256 characters.

type ConfigurationSetName

string

param ConfigurationSetName

The name of the configuration set that you want to use when sending the email.

rtype

dict

returns

Response Syntax

{
    'MessageId': 'string'
}

Response Structure

  • (dict) --

    A unique message ID that you receive when Amazon Pinpoint accepts an email for sending.

    • MessageId (string) --

      A unique identifier for the message that is generated when Amazon Pinpoint accepts the message.

      Note

      It is possible for Amazon Pinpoint to accept a message without sending it. This can happen when the message you're trying to send has an attachment doesn't pass a virus check, or when you send a templated email that contains invalid personalization content, for example.