[SSF 109]: Email automation spike #84
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ℹ️ Issue
Closes #109
📝 Description
This ticket creates an initial part of our email automation. This was actually very straightforward, and followed a similar architecture that JPAL uses. To get this working, I needed to verify my email on AWS SES, which can be done through the following:
AWS_SES_SENDER_EMAIL(all sender emails must be verified). THIS WILL BE UPDATED IN THE README AFTER WE MERGE IN THE ENVIRONMENT VARIABLE PR.Additionally, here is some logic of what each of the file's purposes serve:
awsSesClient.factory.tsserves as the main configuration for the SES Client. It provides the user's access key and id to allow them to use the service API. It also provides a client to be injected later on.awsSes.wrapper.tsinjects this factory into the constructor, making it a valid client that has all SES functionality. This allows us to easily setup the proper parameters to send an email with varying complexity (supporting image attachments as well).email.service.tsprovides the service function that we will actually be calling with our API. All controllers will likely need to use this in their module which we have setup. This allows them to send a simple DTO and send an email just like that.✔️ Verification
I made sure that we could send emails as is, as well as one with email attachments. I created a dummy endpoint for right now in the
pantries.controller.tsfile.🏕️ (Optional) Future Work / Notes
The emails are currently being marked as spam for some reason, not qutie sure as to why yet. Perhaps there is an AWS setting to change that.