Table of Contents
SES.
Client
¶A low-level client representing Amazon Simple Email Service (SES):
import boto3
client = boto3.client('ses')
These are the available methods:
can_paginate()
delete_identity()
delete_identity_policy()
delete_verified_email_address()
generate_presigned_url()
get_identity_dkim_attributes()
get_identity_notification_attributes()
get_identity_policies()
get_identity_verification_attributes()
get_paginator()
get_send_quota()
get_send_statistics()
get_waiter()
list_identities()
list_identity_policies()
list_verified_email_addresses()
put_identity_policy()
send_email()
send_raw_email()
set_identity_dkim_enabled()
set_identity_feedback_forwarding_enabled()
set_identity_notification_topic()
verify_domain_dkim()
verify_domain_identity()
verify_email_address()
verify_email_identity()
can_paginate
(operation_name)¶Check if an operation can be paginated.
Parameters: | operation_name (string) -- The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo , and you'd normally invoke the
operation as client.create_foo(**kwargs) , if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo") . |
---|---|
Returns: | True if the operation can be paginated,
False otherwise. |
delete_identity
(**kwargs)¶Deletes the specified identity (email address or domain) from the list of verified identities.
This action is throttled at one request per second.
Request Syntax
response = client.delete_identity(
Identity='string'
)
Parameters: | Identity (string) -- [REQUIRED] The identity to be removed from the list of identities for the AWS Account. |
---|---|
Return type: | dict |
Returns: | Response Syntax{}
Response Structure
|
delete_identity_policy
(**kwargs)¶Deletes the specified sending authorization policy for the given identity (email address or domain). This API returns successfully even if a policy with the specified name does not exist.
Note
This API is for the identity owner only. If you have not verified the identity, this API will return an error.
Sending authorization is a feature that enables an identity owner to authorize other senders to use its identities. For information about using sending authorization, see the Amazon SES Developer Guide .
This action is throttled at one request per second.
Request Syntax
response = client.delete_identity_policy(
Identity='string',
PolicyName='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {}
Response Structure
|
delete_verified_email_address
(**kwargs)¶Deletes the specified email address from the list of verified addresses.
Warning
The DeleteVerifiedEmailAddress action is deprecated as of the May 15, 2012 release of Domain Verification. The DeleteIdentity action is now preferred.
This action is throttled at one request per second.
Request Syntax
response = client.delete_verified_email_address(
EmailAddress='string'
)
Parameters: | EmailAddress (string) -- [REQUIRED] An email address to be removed from the list of verified addresses. |
---|---|
Returns: | None |
generate_presigned_url
(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)¶Generate a presigned url given a client, its method, and arguments
Parameters: |
|
---|---|
Returns: | The presigned url |
get_identity_dkim_attributes
(**kwargs)¶Returns the current status of Easy DKIM signing for an entity. For domain name identities, this action also returns the DKIM tokens that are required for Easy DKIM signing, and whether Amazon SES has successfully verified that these tokens have been published.
This action takes a list of identities as input and returns the following information for each:
This action is throttled at one request per second and can only get DKIM attributes for up to 100 identities at a time.
For more information about creating DNS records using DKIM tokens, go to the Amazon SES Developer Guide .
Request Syntax
response = client.get_identity_dkim_attributes(
Identities=[
'string',
]
)
Parameters: | Identities (list) -- [REQUIRED] A list of one or more verified identities - email addresses, domains, or both.
|
---|---|
Return type: | dict |
Returns: | Response Syntax{
'DkimAttributes': {
'string': {
'DkimEnabled': True|False,
'DkimVerificationStatus': 'Pending'|'Success'|'Failed'|'TemporaryFailure'|'NotStarted',
'DkimTokens': [
'string',
]
}
}
}
Response Structure
|
get_identity_notification_attributes
(**kwargs)¶Given a list of verified identities (email addresses and/or domains), returns a structure describing identity notification attributes.
This action is throttled at one request per second and can only get notification attributes for up to 100 identities at a time.
For more information about using notifications with Amazon SES, see the Amazon SES Developer Guide .
Request Syntax
response = client.get_identity_notification_attributes(
Identities=[
'string',
]
)
Parameters: | Identities (list) -- [REQUIRED] A list of one or more identities. You can specify an identity by using its name or by using its Amazon Resource Name (ARN). Examples:
|
---|---|
Return type: | dict |
Returns: | Response Syntax{
'NotificationAttributes': {
'string': {
'BounceTopic': 'string',
'ComplaintTopic': 'string',
'DeliveryTopic': 'string',
'ForwardingEnabled': True|False
}
}
}
Response Structure
|
get_identity_policies
(**kwargs)¶Returns the requested sending authorization policies for the given identity (email address or domain). The policies are returned as a map of policy names to policy contents. You can retrieve a maximum of 20 policies at a time.
Note
This API is for the identity owner only. If you have not verified the identity, this API will return an error.
Sending authorization is a feature that enables an identity owner to authorize other senders to use its identities. For information about using sending authorization, see the Amazon SES Developer Guide .
This action is throttled at one request per second.
Request Syntax
response = client.get_identity_policies(
Identity='string',
PolicyNames=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Policies': {
'string': 'string'
}
}
Response Structure
|
get_identity_verification_attributes
(**kwargs)¶Given a list of identities (email addresses and/or domains), returns the verification status and (for domain identities) the verification token for each identity.
This action is throttled at one request per second and can only get verification attributes for up to 100 identities at a time.
Request Syntax
response = client.get_identity_verification_attributes(
Identities=[
'string',
]
)
Parameters: | Identities (list) -- [REQUIRED] A list of identities.
|
---|---|
Return type: | dict |
Returns: | Response Syntax{
'VerificationAttributes': {
'string': {
'VerificationStatus': 'Pending'|'Success'|'Failed'|'TemporaryFailure'|'NotStarted',
'VerificationToken': 'string'
}
}
}
Response Structure
|
get_paginator
(operation_name)¶Create a paginator for an operation.
Parameters: | operation_name (string) -- The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo , and you'd normally invoke the
operation as client.create_foo(**kwargs) , if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo") . |
---|---|
Raises OperationNotPageableError: | |
Raised if the operation is not
pageable. You can use the client.can_paginate method to
check if an operation is pageable. |
|
Return type: | L{botocore.paginate.Paginator} |
Returns: | A paginator object. |
get_send_quota
()¶Returns the user's current sending limits.
This action is throttled at one request per second.
Request Syntax
response = client.get_send_quota()
Return type: | dict |
---|---|
Returns: | Response Syntax{
'Max24HourSend': 123.0,
'MaxSendRate': 123.0,
'SentLast24Hours': 123.0
}
Response Structure
|
get_send_statistics
()¶Returns the user's sending statistics. The result is a list of data points, representing the last two weeks of sending activity.
Each data point in the list contains statistics for a 15-minute interval.
This action is throttled at one request per second.
Request Syntax
response = client.get_send_statistics()
Return type: | dict |
---|---|
Returns: | Response Syntax{
'SendDataPoints': [
{
'Timestamp': datetime(2015, 1, 1),
'DeliveryAttempts': 123,
'Bounces': 123,
'Complaints': 123,
'Rejects': 123
},
]
}
Response Structure
|
get_waiter
(waiter_name)¶list_identities
(**kwargs)¶Returns a list containing all of the identities (email addresses and domains) for a specific AWS Account, regardless of verification status.
This action is throttled at one request per second.
Request Syntax
response = client.list_identities(
IdentityType='EmailAddress'|'Domain',
NextToken='string',
MaxItems=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Identities': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
list_identity_policies
(**kwargs)¶Returns a list of sending authorization policies that are attached to the given identity (email address or domain). This API returns only a list. If you want the actual policy content, you can use GetIdentityPolicies
.
Note
This API is for the identity owner only. If you have not verified the identity, this API will return an error.
Sending authorization is a feature that enables an identity owner to authorize other senders to use its identities. For information about using sending authorization, see the Amazon SES Developer Guide .
This action is throttled at one request per second.
Request Syntax
response = client.list_identity_policies(
Identity='string'
)
Parameters: | Identity (string) -- [REQUIRED] The identity that is associated with the policy for which the policies will be listed. You can specify an identity by using its name or by using its Amazon Resource Name (ARN). Examples: To successfully call this API, you must own the identity. |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'PolicyNames': [
'string',
]
}
Response Structure
|
list_verified_email_addresses
()¶Returns a list containing all of the email addresses that have been verified.
Warning
The ListVerifiedEmailAddresses action is deprecated as of the May 15, 2012 release of Domain Verification. The ListIdentities action is now preferred.
This action is throttled at one request per second.
Request Syntax
response = client.list_verified_email_addresses()
Return type: | dict |
---|---|
Returns: | Response Syntax{
'VerifiedEmailAddresses': [
'string',
]
}
Response Structure
|
put_identity_policy
(**kwargs)¶Adds or updates a sending authorization policy for the specified identity (email address or domain).
Note
This API is for the identity owner only. If you have not verified the identity, this API will return an error.
Sending authorization is a feature that enables an identity owner to authorize other senders to use its identities. For information about using sending authorization, see the Amazon SES Developer Guide .
This action is throttled at one request per second.
Request Syntax
response = client.put_identity_policy(
Identity='string',
PolicyName='string',
Policy='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {}
Response Structure
|
send_email
(**kwargs)¶Composes an email message based on input data, and then immediately queues the message for sending.
There are several important points to know about SendEmail
:
Request Syntax
response = client.send_email(
Source='string',
Destination={
'ToAddresses': [
'string',
],
'CcAddresses': [
'string',
],
'BccAddresses': [
'string',
]
},
Message={
'Subject': {
'Data': 'string',
'Charset': 'string'
},
'Body': {
'Text': {
'Data': 'string',
'Charset': 'string'
},
'Html': {
'Data': 'string',
'Charset': 'string'
}
}
},
ReplyToAddresses=[
'string',
],
ReturnPath='string',
SourceArn='string',
ReturnPathArn='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'MessageId': 'string'
}
Response Structure
|
send_raw_email
(**kwargs)¶Sends an email message, with header and content specified by the client. The SendRawEmail
action is useful for sending multipart MIME emails. The raw text of the message must comply with Internet email standards; otherwise, the message cannot be sent.
There are several important points to know about SendRawEmail
:
SendRawEmail
enables you to specify the cross-account identity for the email's "Source," "From," and "Return-Path" parameters in one of two ways: you can pass optional parameters SourceArn
, FromArn
, and/or ReturnPathArn
to the API, or you can include the following X-headers in the header of your raw email: * X-SES-SOURCE-ARN
X-SES-FROM-ARN
X-SES-RETURN-PATH-ARN
Warning
Do not include these X-headers in the DKIM signature, because they are removed by Amazon SES before sending the email.
For the most common sending authorization use case, we recommend that you specify the SourceIdentityArn
and do not specify either the FromIdentityArn
or ReturnPathIdentityArn
. (The same note applies to the corresponding X-headers.) If you only specify the SourceIdentityArn
, Amazon SES will simply set the "From" address and the "Return Path" address to the identity specified in SourceIdentityArn
. For more information about sending authorization, see the Amazon SES Developer Guide .
Request Syntax
response = client.send_raw_email(
Source='string',
Destinations=[
'string',
],
RawMessage={
'Data': b'bytes'
},
FromArn='string',
SourceArn='string',
ReturnPathArn='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'MessageId': 'string'
}
Response Structure
|
set_identity_dkim_enabled
(**kwargs)¶Enables or disables Easy DKIM signing of email sent from an identity:
example.com
), then Amazon SES will DKIM-sign all email sent by addresses under that domain name (e.g., user@example.com
).For email addresses (e.g., user@example.com
), you can only enable Easy DKIM signing if the corresponding domain (e.g., example.com
) has been set up for Easy DKIM using the AWS Console or the VerifyDomainDkim
action.
This action is throttled at one request per second.
For more information about Easy DKIM signing, go to the Amazon SES Developer Guide .
Request Syntax
response = client.set_identity_dkim_enabled(
Identity='string',
DkimEnabled=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {}
Response Structure
|
set_identity_feedback_forwarding_enabled
(**kwargs)¶Given an identity (email address or domain), enables or disables whether Amazon SES forwards bounce and complaint notifications as email. Feedback forwarding can only be disabled when Amazon Simple Notification Service (Amazon SNS) topics are specified for both bounces and complaints.
Note
Feedback forwarding does not apply to delivery notifications. Delivery notifications are only available through Amazon SNS.
This action is throttled at one request per second.
For more information about using notifications with Amazon SES, see the Amazon SES Developer Guide .
Request Syntax
response = client.set_identity_feedback_forwarding_enabled(
Identity='string',
ForwardingEnabled=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {}
Response Structure
|
set_identity_notification_topic
(**kwargs)¶Given an identity (email address or domain), sets the Amazon Simple Notification Service (Amazon SNS) topic to which Amazon SES will publish bounce, complaint, and/or delivery notifications for emails sent with that identity as the Source
.
Note
Unless feedback forwarding is enabled, you must specify Amazon SNS topics for bounce and complaint notifications. For more information, see SetIdentityFeedbackForwardingEnabled
.
This action is throttled at one request per second.
For more information about feedback notification, see the Amazon SES Developer Guide .
Request Syntax
response = client.set_identity_notification_topic(
Identity='string',
NotificationType='Bounce'|'Complaint'|'Delivery',
SnsTopic='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {}
Response Structure
|
verify_domain_dkim
(**kwargs)¶Returns a set of DKIM tokens for a domain. DKIM tokens are character strings that represent your domain's identity. Using these tokens, you will need to create DNS CNAME records that point to DKIM public keys hosted by Amazon SES. Amazon Web Services will eventually detect that you have updated your DNS records; this detection process may take up to 72 hours. Upon successful detection, Amazon SES will be able to DKIM-sign email originating from that domain.
This action is throttled at one request per second.
To enable or disable Easy DKIM signing for a domain, use the SetIdentityDkimEnabled
action.
For more information about creating DNS records using DKIM tokens, go to the Amazon SES Developer Guide .
Request Syntax
response = client.verify_domain_dkim(
Domain='string'
)
Parameters: | Domain (string) -- [REQUIRED] The name of the domain to be verified for Easy DKIM signing. |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'DkimTokens': [
'string',
]
}
Response Structure
|
verify_domain_identity
(**kwargs)¶Verifies a domain.
This action is throttled at one request per second.
Request Syntax
response = client.verify_domain_identity(
Domain='string'
)
Parameters: | Domain (string) -- [REQUIRED] The domain to be verified. |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'VerificationToken': 'string'
}
Response Structure
|
verify_email_address
(**kwargs)¶Verifies an email address. This action causes a confirmation email message to be sent to the specified address.
Warning
The VerifyEmailAddress action is deprecated as of the May 15, 2012 release of Domain Verification. The VerifyEmailIdentity action is now preferred.
This action is throttled at one request per second.
Request Syntax
response = client.verify_email_address(
EmailAddress='string'
)
Parameters: | EmailAddress (string) -- [REQUIRED] The email address to be verified. |
---|---|
Returns: | None |
verify_email_identity
(**kwargs)¶Verifies an email address. This action causes a confirmation email message to be sent to the specified address.
This action is throttled at one request per second.
Request Syntax
response = client.verify_email_identity(
EmailAddress='string'
)
Parameters: | EmailAddress (string) -- [REQUIRED] The email address to be verified. |
---|---|
Return type: | dict |
Returns: | Response Syntax{}
Response Structure
|
The available paginators are:
SES.Paginator.
list_identities
¶paginator = client.get_paginator('list_identities')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from SES.Client.list_identities()
.
Request Syntax
response_iterator = paginator.paginate(
IdentityType='EmailAddress'|'Domain',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Identities': [
'string',
],
}
Response Structure
|
The available waiters are:
SES.Waiter.
identity_exists
¶waiter = client.get_waiter('identity_exists')
wait
(**kwargs)¶This polls SES.Client.get_identity_verification_attributes()
every 3 seconds until a successful state is reached. An error is returned after 20 failed checks.
Request Syntax
waiter.wait(
Identities=[
'string',
]
)
Parameters: | Identities (list) -- [REQUIRED] A list of identities.
|
---|---|
Returns: | None |