SES¶
Utilities for working with Amazon Simple Email Service.
is_verified ¶
is_verified(identity)
Check if an email address or domain identity is verified in SES.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identity
|
str
|
The email address or domain to check. |
required |
Raises:
| Type | Description |
|---|---|
AWSError
|
If the verification status cannot be checked. |
Returns:
| Type | Description |
|---|---|
bool
|
True if the identity is verified, False otherwise. |
Example
# Check email identity
is_verified('myemail@subdomain.domain.com')
# Check subdomain identity
is_verified('subdomain.domain.com')
# Check domain identity
is_verified('domain.com')
Source code in src/aibs_informatics_aws_utils/ses.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
send_email ¶
send_email(request)
Send an email using SES.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
SendEmailRequestTypeDef
|
The SES send email request configuration. |
required |
Raises:
| Type | Description |
|---|---|
AWSError
|
If the email cannot be sent. |
Returns:
| Type | Description |
|---|---|
SendEmailResponseTypeDef
|
The send email response containing the message ID. |
Source code in src/aibs_informatics_aws_utils/ses.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
send_email_with_attachment ¶
send_email_with_attachment(
source,
to_addresses,
subject,
body="",
attachments_paths=None,
)
Send an email with attachments using SES.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Union[str, EmailAddress]
|
The sender email address. |
required |
to_addresses
|
Sequence[Union[str, EmailAddress]]
|
List of recipient addresses. |
required |
subject
|
str
|
The email subject line. |
required |
body
|
Union[str, MIMEText]
|
The email body (plain text or MIMEText for HTML). |
''
|
attachments_paths
|
Optional[List[Path]]
|
Optional list of file paths to attach. |
None
|
Returns:
| Type | Description |
|---|---|
SendRawEmailResponseTypeDef
|
The send raw email response containing the message ID. |
Source code in src/aibs_informatics_aws_utils/ses.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
send_raw_email ¶
send_raw_email(request)
Send a raw MIME email using SES.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
SendRawEmailRequestTypeDef
|
The SES send raw email request. |
required |
Raises:
| Type | Description |
|---|---|
AWSError
|
If the email cannot be sent. |
Returns:
| Type | Description |
|---|---|
SendRawEmailResponseTypeDef
|
The send raw email response containing the message ID. |
Source code in src/aibs_informatics_aws_utils/ses.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
send_simple_email ¶
send_simple_email(source, to_addresses, subject, body='')
Send a simple text email using SES.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Union[str, EmailAddress]
|
The sender email address. |
required |
to_addresses
|
Sequence[Union[str, EmailAddress]]
|
List of recipient addresses. |
required |
subject
|
str
|
The email subject line. |
required |
body
|
str
|
The email body text. Defaults to empty string. |
''
|
Returns:
| Type | Description |
|---|---|
SendEmailResponseTypeDef
|
The send email response containing the message ID. |
Source code in src/aibs_informatics_aws_utils/ses.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
verify_email_identity ¶
verify_email_identity(email_address)
Send a verification email to an email address.
Initiates the email verification process for SES. The recipient will receive an email with a verification link.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email_address
|
str
|
The email address to verify. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
The SES verify email identity response. |
Source code in src/aibs_informatics_aws_utils/ses.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |