red-mail
red-mail copied to clipboard
ENH: Add support for relaying emails via `boto3` for use cases where apps running in AWS use IAM policies to authenticate against SES
Is your feature request related to a problem? Please describe. Whilst Amazon SES offers relaying emails via SMTP there are cases where the environment is configured to use IAM policies for authentication. This applies to services like S3 for file storage or SES for email relay.
In these use cases the application would simply instantiate the boto3
client as:
import boto3
ses_client = boto3.client("ses", regional_name="ap-southeast-2")
and use their send_email
function to send the message without the need of authenticating.
Describe the solution you'd like
If it's amicable with the design of this project then I would like to be able to initialise EmailSender
with preconfigure boto3
client no different to how we can pass a custom SMTP
instance.
import boto3
ses_client = boto3.client("ses", regional_name="ap-southeast-2")
sender = EmailSender(boto3_client=ses_client)
the send
function would then use the boto3
client instead of an SMTP server to relay the emails.This way we get the array of functionality (namely templating) that this library offers and integrate into a platform like AWS.
Describe alternatives you've considered
At the moment our only alternative is to render Jinja templates on our own and then relay messages via boto3
.
Additional context This may be relevant to other cloud services like GCP or Azure. We've been working with the lovely folk @resendlabs who maintain a Python idiomatic SDK and could see this as an enhancement.
I would personally be willing to work on the boto3
and resend
integration and provide a pull request :)