PinpointEmail.Client.
send_email
(**kwargs)¶Sends an email message. You can use the Amazon Pinpoint Email API to send two types of messages:
See also: AWS API Documentation
Request Syntax
response = 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'
)
[REQUIRED]
An object that contains the recipients of the email message.
An array that contains the email addresses of the "To" recipients for the email.
An array that contains the email addresses of the "CC" (carbon copy) recipients for the email.
An array that contains the email addresses of the "BCC" (blind carbon copy) recipients for the email.
The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.
[REQUIRED]
An object that contains the body of the message. You can send either a Simple message or a Raw message.
The simple email message. The message consists of a subject and a message body.
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.
The content of the message itself.
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
.
The body of the message. You can specify an HTML version of the message, a text-only version of the message, or both.
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.
The content of the message itself.
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
.
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.
The content of the message itself.
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
.
The raw email message. The message has to meet the following criteria:
The raw email message. The message has to meet the following criteria:
The template to use for the email message.
The Amazon Resource Name (ARN) of the template.
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.
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.
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.
The name of the message tag. The message tag name has to meet the following criteria:
The value of the message tag. The message tag value has to meet the following criteria:
dict
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.
Exceptions
PinpointEmail.Client.exceptions.TooManyRequestsException
PinpointEmail.Client.exceptions.LimitExceededException
PinpointEmail.Client.exceptions.AccountSuspendedException
PinpointEmail.Client.exceptions.SendingPausedException
PinpointEmail.Client.exceptions.MessageRejected
PinpointEmail.Client.exceptions.MailFromDomainNotVerifiedException
PinpointEmail.Client.exceptions.NotFoundException
PinpointEmail.Client.exceptions.BadRequestException