Simple Email Service (SES)
2 minute read
Sent Emails
LocalStack keeps track of all sent emails for retrospection. The sent messages can be retrieved in following ways:
- Filesystem: All messages are saved to the state directory (see filesystem layout).
The files are saved as JSON in the
ses/
subdirectory and organised by message ID. - API endpoint: LocalStack provides a service endpoint (
/_aws/ses
) which can be used to return in-memory saved messages. AGET
call returns all messages. Query parametersid
andemail
can be used to filter by message ID and message source respectively. ADELETE
call clears all messages from the memory. The query parameterid
can be used to delete only a specific message.
SMTP Integration
LocalStack Pro ships with support for sending SES messages through an actual SMTP email server.
Please refer to the Configuration guide for instructions on how to configure the connection parameters of your SMTP server (SMTP_HOST
/SMTP_USER
/SMTP_PASS
).
Once the SMTP server has been configured, the SES user interface in the Web app can be used to create a new email account (e.g., user1@yourdomain.com
).
Emails can be sent via the command line (or SES client SDK):
$ awslocal ses send-email \
--from user1@yourdomain.com \
--message 'Body={Text={Data="Lorem ipsum dolor sit amet, consectetur adipiscing elit, ..."}},Subject={Data=Test Email}' \
--destination 'ToAddresses=recipient1@example.com'
Hint
If you receive a “Email address not verified message”, simply call
awslocal ses verify-email-identity --email-address user1@yourdomain.com
User Interface
LocalStack Web app can be used to view the sent email messages, as illustrated in the screenshot below: