send_email
async
¶
send_email(
content: EmailContent,
*,
config_overrides: Optional[AsyncSESv2ClientConfig] = None,
from_email_address: Optional[EmailAddress] = None,
from_email_address_identity_arn: Optional[AmazonResourceName] = None,
destination: Optional[Destination] = None,
reply_to_addresses: Optional[EmailAddressList] = None,
feedback_forwarding_email_address: Optional[EmailAddress] = None,
feedback_forwarding_email_address_identity_arn: Optional[AmazonResourceName] = None,
email_tags: Optional[MessageTagList] = None,
configuration_set_name: Optional[ConfigurationSetName] = None,
endpoint_id: Optional[EndpointId] = None,
tenant_name: Optional[TenantName] = None,
list_management_options: Optional[ListManagementOptions] = None,
configuration_overrides: Optional[ConfigurationOverrides] = None,
) -> SendEmailResponse
Sends an email message. You can use the Amazon SES API v2 to send the following 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 SES 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.
-
Templated – A message that contains personalization tags. When you send this type of email, Amazon SES API v2 automatically replaces the tags with values that you specify.
Parameters:
-
from_email_address(Optional[EmailAddress], default:None) –The email address to use as the "From" address for the email. The address that you specify has to be verified.
-
from_email_address_identity_arn(Optional[AmazonResourceName], default:None) –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
FromEmailAddressparameter.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 [email protected], then you would specify the
FromEmailAddressIdentityArnto be arn:aws:ses:us-east-1:123456789012:identity/example.com, and theFromEmailAddressto be [email protected].For more information about sending authorization, see the Amazon SES Developer Guide.
For Raw emails, the
FromEmailAddressIdentityArnvalue overrides the X-SES-SOURCE-ARN and X-SES-FROM-ARN headers specified in raw email message content. -
destination(Optional[Destination], default:None) –An object that contains the recipients of the email message.
-
reply_to_addresses(Optional[EmailAddressList], default:None) –The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.
-
feedback_forwarding_email_address(Optional[EmailAddress], default:None) –The address that you want bounce and complaint notifications to be sent to.
-
feedback_forwarding_email_address_identity_arn(Optional[AmazonResourceName], default:None) –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
FeedbackForwardingEmailAddressparameter.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 [email protected], then you would specify the
FeedbackForwardingEmailAddressIdentityArnto be arn:aws:ses:us-east-1:123456789012:identity/example.com, and theFeedbackForwardingEmailAddressto be [email protected].For more information about sending authorization, see the Amazon SES Developer Guide.
-
content(EmailContent) –An object that contains the body of the message. You can send either a Simple message, Raw message, or a Templated message.
-
email_tags(Optional[MessageTagList], default:None) –A list of tags, in the form of name/value pairs, to apply to an email that you send using the
SendEmailoperation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events. -
configuration_set_name(Optional[ConfigurationSetName], default:None) –The name of the configuration set to use when sending the email.
-
endpoint_id(Optional[EndpointId], default:None) –The ID of the multi-region endpoint (global-endpoint).
-
tenant_name(Optional[TenantName], default:None) –The name of the tenant through which this email will be sent.
The email sending operation will only succeed if all referenced resources (identities, configuration sets, and templates) are associated with this tenant.
-
list_management_options(Optional[ListManagementOptions], default:None) –An object used to specify a list or topic to which an email belongs, which will be used when a contact chooses to unsubscribe.
-
configuration_overrides(Optional[ConfigurationOverrides], default:None) –An object that overrides, for this message only, settings that would otherwise apply to it. Each setting that you don't override keeps the value that already applies.
Raises:
-
AccountSuspendedException–The message can't be sent because the account's ability to send email has been permanently restricted.
-
BadRequestException–The input you provided is invalid.
-
LimitExceededException–There are too many instances of the specified resource type.
-
MailFromDomainNotVerifiedException–The message can't be sent because the sending domain isn't verified.
-
MessageRejected–The message can't be sent because it contains invalid content.
-
NotFoundException–The resource you attempted to access doesn't exist.
-
SendingPausedException–The message can't be sent because the account's ability to send email is currently paused.
-
TooManyRequestsException–Too many requests have been made to the operation.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_sesv2/_services/async_se_sv2.py
6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 | |