Note

You are viewing the documentation for an older version of boto (boto2).

Boto3, the next version of Boto, is now stable and recommended for general use. It can be used side-by-side with Boto in the same project, so it is easy to start using Boto3 in your existing projects as well as new projects. Going forward, API updates and all new feature work will be focused on Boto3.

For more information, see the documentation for boto3.

SES

boto.ses

boto.ses.connect_to_region(region_name, **kw_params)

Given a valid region name, return a boto.ses.connection.SESConnection.

Type:str
Parameters:region_name – The name of the region to connect to.
Return type:boto.ses.connection.SESConnection or None
Returns:A connection to the given region, or None if an invalid region name is given
boto.ses.regions()

Get all available regions for the SES service.

Return type:list
Returns:A list of boto.regioninfo.RegionInfo instances

boto.ses.connection

class boto.ses.connection.SESConnection(aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', security_token=None, validate_certs=True, profile_name=None)
APIVersion = '2010-12-01'
DefaultRegionEndpoint = 'email.us-east-1.amazonaws.com'
DefaultRegionName = 'us-east-1'
ResponseError

alias of boto.exception.BotoServerError

delete_identity(identity)

Deletes the specified identity (email address or domain) from the list of verified identities.

Parameters:identity (string) – The identity to be deleted.
Return type:dict
Returns:A DeleteIdentityResponse structure. Note that keys must be unicode strings.
delete_verified_email_address(email_address)

Deletes the specified email address from the list of verified addresses.

Parameters:email_address – The email address to be removed from the list of verified addreses.
Return type:dict
Returns:A DeleteVerifiedEmailAddressResponse structure. Note that keys must be unicode strings.
get_identity_dkim_attributes(identities)

Get attributes associated with a list of verified identities.

Given a list of verified identities (email addresses and/or domains), returns a structure describing identity notification attributes.

Parameters:identities (list) – A list of verified identities (email addresses and/or domains).
get_identity_verification_attributes(identities)

Given a list of identities (email addresses and/or domains), returns the verification status and (for domain identities) the verification token for each identity.

Parameters:identities (list of strings or string) – List of identities.
Return type:dict
Returns:A GetIdentityVerificationAttributesResponse structure. Note that keys must be unicode strings.
get_send_quota()

Fetches the user’s current activity limits.

Return type:dict
Returns:A GetSendQuotaResponse structure. Note that keys must be unicode strings.
get_send_statistics()

Fetches 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.

Return type:dict
Returns:A GetSendStatisticsResponse structure. Note that keys must be unicode strings.
list_identities()

Returns a list containing all of the identities (email addresses and domains) for a specific AWS Account, regardless of verification status.

Return type:dict
Returns:A ListIdentitiesResponse structure. Note that keys must be unicode strings.
list_verified_email_addresses()

Fetch a list of the email addresses that have been verified.

Return type:dict
Returns:A ListVerifiedEmailAddressesResponse structure. Note that keys must be unicode strings.
send_email(source, subject, body, to_addresses, cc_addresses=None, bcc_addresses=None, format='text', reply_addresses=None, return_path=None, text_body=None, html_body=None)

Composes an email message based on input data, and then immediately queues the message for sending.

Parameters:
  • source (string) – The sender’s email address.
  • subject (string) – The subject of the message: A short summary of the content, which will appear in the recipient’s inbox.
  • body (string) – The message body.
  • to_addresses (list of strings or string) – The To: field(s) of the message.
  • cc_addresses (list of strings or string) – The CC: field(s) of the message.
  • bcc_addresses (list of strings or string) – The BCC: field(s) of the message.
  • format (string) – The format of the message’s body, must be either “text” or “html”.
  • reply_addresses (list of strings or string) – The reply-to email address(es) for the message. If the recipient replies to the message, each reply-to address will receive the reply.
  • return_path (string) – The email address to which bounce notifications are to be forwarded. If the message cannot be delivered to the recipient, then an error message will be returned from the recipient’s ISP; this message will then be forwarded to the email address specified by the ReturnPath parameter.
  • text_body (string) – The text body to send with this email.
  • html_body (string) – The html body to send with this email.
send_raw_email(raw_message, source=None, destinations=None)

Sends an email message, with header and content specified by the client. The SendRawEmail action is useful for sending multipart MIME emails, with attachments or inline content. The raw text of the message must comply with Internet email standards; otherwise, the message cannot be sent.

Parameters:
  • source (string) –

    The sender’s email address. Amazon’s docs say:

    If you specify the Source parameter, then bounce notifications and complaints will be sent to this email address. This takes precedence over any Return-Path header that you might include in the raw text of the message.

  • raw_message (string) –

    The raw text of the message. The client is responsible for ensuring the following:

    • Message must contain a header and a body, separated by a blank line.
    • All required header fields must be present.
    • Each part of a multipart MIME message must be formatted properly.
    • MIME content types must be among those supported by Amazon SES. Refer to the Amazon SES Developer Guide for more details.
    • Content must be base64-encoded, if MIME requires it.
  • destinations (list of strings or string) – A list of destinations for the message.
set_identity_dkim_enabled(identity, dkim_enabled)

Enables or disables DKIM signing of email sent from an identity.

  • If Easy DKIM signing is enabled for a domain name identity (e.g.,
  • example.com), then Amazon SES will DKIM-sign all email sent by addresses under that domain name (e.g., user@example.com)
  • If Easy DKIM signing is enabled for an email address, then Amazon SES will DKIM-sign all email sent by that email address.

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.

Parameters:
  • identity (string) – An email address or domain name.
  • dkim_enabled (bool) – Specifies whether or not to enable DKIM signing.
set_identity_feedback_forwarding_enabled(identity, forwarding_enabled=True)

Enables or disables SES feedback notification via email. Feedback forwarding may only be disabled when both complaint and bounce topics are set.

Parameters:
  • identity (string) – An email address or domain name.
  • forwarding_enabled (bool) – Specifies whether or not to enable feedback forwarding.
set_identity_notification_topic(identity, notification_type, sns_topic=None)

Sets an SNS topic to publish bounce or complaint notifications for emails sent with the given identity as the Source. Publishing to topics may only be disabled when feedback forwarding is enabled.

Parameters:
  • identity (string) – An email address or domain name.
  • notification_type (string) – The type of feedback notifications that will be published to the specified topic. Valid Values: Bounce | Complaint | Delivery
  • sns_topic (string or None) – The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.
verify_domain_dkim(domain)

Returns a set of DNS records, or tokens, that must be published in the domain name’s DNS to complete the DKIM verification process. These tokens are DNS CNAME records that point to DKIM public keys hosted by Amazon SES. To complete the DKIM verification process, these tokens must be published in the domain’s DNS. The tokens must remain published in order for Easy DKIM signing to function correctly.

After the tokens are added to the domain’s DNS, Amazon SES will be able to DKIM-sign email originating from that domain. To enable or disable Easy DKIM signing for a domain, use the SetIdentityDkimEnabled action. For more information about Easy DKIM, go to the Amazon SES Developer Guide.

Parameters:domain (string) – The domain name.
verify_domain_identity(domain)

Verifies a domain.

Parameters:domain (string) – The domain to be verified.
Return type:dict
Returns:A VerifyDomainIdentityResponse structure. Note that keys must be unicode strings.
verify_email_address(email_address)

Verifies an email address. This action causes a confirmation email message to be sent to the specified address.

Parameters:email_address – The email address to be verified.
Return type:dict
Returns:A VerifyEmailAddressResponse structure. Note that keys must be unicode strings.
verify_email_identity(email_address)

Verifies an email address. This action causes a confirmation email message to be sent to the specified address.

Parameters:email_address – The email address to be verified.
Return type:dict
Returns:A VerifyEmailIdentityResponse structure. Note that keys must be unicode strings.