Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
aioaws SES example
from pathlib import Path
from httpx import AsyncClient
from import SesConfig, SesClient, SesRecipient, SesAttachment
async def ses_demo(client: AsyncClient):
ses_client = SesClient(client, SesConfig('<access key>', '<secret key>', '<region>'))
message_id = await ses_client.send_email(
SesRecipient('', 'Sender', 'Name'),
'This is the subject',
[SesRecipient('', 'John', 'Doe')],
'this is the plain text body',
html_body='<b>This is the HTML body.<b>',
SesAttachment(b'this is content', 'attachment-name.txt', 'text/plain'),
configuration_set='SES configuration set',
message_tags={'ses': 'tags', 'go': 'here'},
print('SES message ID:', message_id)
async def main():
async with AsyncClient() as client:
await ses_demo(client)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment