send_email
¶
send_email(
content: EmailContent,
*,
config_overrides: Optional[SESv2ClientConfig] = 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/se_sv2.py
6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 | |