Debian Codegraph @

docs/source/guide/ses-verify.rst

raw
1 .. Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
3 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0
4 International License (the "License"). You may not use this file except in compliance with the
5 License. A copy of the License is located at http://creativecommons.org/licenses/by-nc-sa/4.0/.
6
7 This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
8 either express or implied. See the License for the specific language governing permissions and
9 limitations under the License.
10
11 .. _aws-boto3-ses-verify:
12
13
14 ############################################
15 Verifying email identities in Amazon SES
16 ############################################
17
18 .. meta::
19 :description: Use Amazon SES API to verify email addresses and domains.
20 :keywords: SES Python
21
22 When you first start using your Amazon Simple Email Service (SES) account,
23 all senders and recipients must be verified in the same AWS Region that you
24 will be sending emails to. For more information about sending emails, see
25 `Sending Email with Amazon
26 SES <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-email.html>`__.
27
28 The following examples show how to:
29
30 * Verify an email address using `verify_email_identity() <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ses.html#SES.Client.verify_email_identity>`__.
31 * Verify an email domain using `verify_domain_identity() <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ses.html#SES.Client.verify_domain_identity>`__.
32 * List all email addresses or domains using `list_identities() <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ses.html#SES.Client.list_identities>`__.
33 * Remove an email address or domain using `delete_identity() <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ses.html#SES.Client.delete_identity>`__.
34
35 Prerequisite tasks
36 ==================
37
38 To set up and run this example, you must first complete these tasks:
39
40 * Configure your AWS credentials, as described in :doc:`quickstart`.
41
42
43 Verify an email address
44 =======================
45 SES can send email only from verified email addresses or domains. By
46 verifying an email address, you demonstrate that you're the owner of that
47 address and want to allow SES to send email from that address.
48
49 When you run the following code example, SES sends an email to the address
50 you specified. When you (or the recipient of the email) click the link in
51 the email, the address is verified.
52
53 To add an email address to your SES account, use the
54 `VerifyEmailIdentity <https://docs.aws.amazon.com/ses/latest/APIReference/API_VerifyEmailIdentity.html>`__
55 operation.
56
57 Example
58 -------
59
60 .. code-block:: python
61
62 import boto3
63
64 # Create SES client
65 ses = boto3.client('ses')
66
67 response = ses.verify_email_identity(
68 EmailAddress = 'EMAIL_ADDRESS'
69 )
70
71 print(response)
72
73
74 Verify an email domain
75 ======================
76
77 SES can send email only from verified email addresses or domains. By verifying
78 a domain, you demonstrate that you're the owner of that domain. When you
79 verify a domain, you allow SES to send email from any address on that domain.
80
81 When you run the following code example, SES provides you with a verification
82 token. You have to add the token to your domain's DNS configuration. For more
83 information, see `Verifying a Domain with Amazon
84 SES <http://aws.amazon.com/documentation/ses/verify-domain-procedure.html>`_.
85
86 To add a sending domain to your SES account, use the
87 `VerifyDomainIdentity <https://docs.aws.amazon.com/ses/latest/APIReference/API_VerifyDomainIdentity.html>`_
88 operation.
89
90 Example
91 -------
92
93 .. code-block:: python
94
95 import boto3
96
97 # Create SES client
98 ses = boto3.client('ses')
99
100 response = ses.verify_domain_identity(
101 Domain='DOMAIN_NAME'
102 )
103
104 print(response)
105
106
107 List email addresses
108 ====================
109
110 To retrieve a list of email addresses submitted in the current AWS Region,
111 regardless of verification status, use the
112 `ListIdentities <https://docs.aws.amazon.com/ses/latest/APIReference/API_ListIdentities.html>`__
113 operation.
114
115 Example
116 -------
117
118 .. code-block:: python
119
120 import boto3
121
122 # Create SES client
123 ses = boto3.client('ses')
124
125 response = ses.list_identities(
126 IdentityType = 'EmailAddress',
127 MaxItems=10
128 )
129
130 print(response)
131
132
133 List email domains
134 ==================
135
136 To retrieve a list of email domains submitted in the current AWS Region,
137 regardless of verification status use the
138 `ListIdentities <https://docs.aws.amazon.com/ses/latest/APIReference/API_ListIdentities.html>`__
139 operation.
140
141 Example
142 -------
143
144 .. code-block:: python
145
146 import boto3
147
148 # Create SES client
149 ses = boto3.client('ses')
150
151 response = ses.list_identities(
152 IdentityType = 'Domain',
153 MaxItems=10
154 )
155
156 print(response)
157
158
159 Delete an email address
160 =======================
161
162 To delete a verified email address from the list of verified identities, use
163 the `DeleteIdentity <https://docs.aws.amazon.com/ses/latest/APIReference/API_DeleteIdentity.html>`__
164 operation.
165
166 Example
167 -------
168
169 .. code-block:: python
170
171 import boto3
172
173 # Create SES client
174 ses = boto3.client('ses')
175
176 response = ses.delete_identity(
177 Identity = 'EMAIL_ADDRESS'
178 )
179
180 print(response)
181
182
183 Delete an email domain
184 ======================
185
186 To delete a verified email domain from the list of verified identities, use the
187 `DeleteIdentity <https://docs.aws.amazon.com/ses/latest/APIReference/API_DeleteIdentity.html>`__
188 operation.
189
190 Example
191 -------
192
193 .. code-block:: python
194
195 import boto3
196
197 # Create SES client
198 ses = boto3.client('ses')
199
200 response = ses.delete_identity(
201 Identity = 'DOMAIN_NAME'
202 )
203
204 print(response)