Skip to content

#43 - Create endpoint for sending emails#54

Open
piersolh wants to merge 8 commits intomainfrom
piersol-create-endpoint-for-sending-emails
Open

#43 - Create endpoint for sending emails#54
piersolh wants to merge 8 commits intomainfrom
piersol-create-endpoint-for-sending-emails

Conversation

@piersolh
Copy link

@piersolh piersolh commented Jan 25, 2026

Description

Briefly describe the changes and why they are needed.

  • Enable FCC to send emails to donors

Changes Made

  • Backend changes
  • Frontend changes
  • Database schema changes
  • Configuration updates
  • Other

Testing & Verification

  • Unit tests pass
  • Manual testing completed

IMPORTANT!!!

  • No breaking changes - 🚨 code will break if you don't add your AWS key to the docker-compose.dev.yml 🚨

Verification Steps:

  1. Wrote unit tests
  2. Tested by sending a few emails to myself
  1. Unit tests passed
  2. Emails were sent and received by me

Screenshots (if relevant)

Screenshot 2026-02-08 at 9 43 47 AM Screenshot 2026-02-08 at 9 57 28 AM

Future Improvements/Notes

  1. Move key management to team wide secrets manager (followup ticket: Migrate Env Variables to AWS Secrets Manager #57)
  2. Add email templates (recurring donor email template, thank you email template, etc)

Related Issues

Closes #43

@piersolh piersolh linked an issue Jan 25, 2026 that may be closed by this pull request
@piersolh piersolh changed the title added some intial scaffolding, not compiling for some reason #43 - Create endpoint for sending emails Feb 8, 2026
import { SES as AmazonSESClient } from '@aws-sdk/client-ses';
import { strict as assert } from 'node:assert';
import * as dotenv from 'dotenv';
import path from 'node:path';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled getting the docker to recognize the env variables, might not be necessary once we move to secrets manager?

import path from 'node:path';
dotenv.config({ path: path.resolve(__dirname, '.env') });

export const AMAZON_SES_CLIENT = 'AMAZON_SES_CLIENT';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to hardcode this so that nestJS would recognize it, otherwise I got the error that ERROR [ExceptionHandler] Nest can't resolve dependencies of the EmailsService (?).

constructor(private readonly emailService: EmailsService) {}

@Post('send-email')
// @UseGuards(JwtAuthGuard) (should use auth, not implemented rn)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented out for now, should be uncommented once auth is added to the project for security

@@ -0,0 +1,116 @@
import { Test, TestingModule } from '@nestjs/testing';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this sufficient testing? I am still new to backend

useFactory: (configService: ConfigService) => {
return new Stripe(configService.get<string>('STRIPE_SECRET_KEY'), {
apiVersion: '2025-09-30.clover',
apiVersion: '2025-12-15.clover',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep having an issue with this file reverting / changing versions when I load my docker containers. I am not sure why this is happening.

@@ -50,7 +50,6 @@ function Button({
}) {
const Comp = asChild ? Slot : 'button';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not modify, this is from merging my PR with main to avoid merge conflicts

JWT_SECRET: dev-secret-change-in-prod

AWS_SES_REGION: us-east-2
AWS_SES_ACCESS_KEY_ID:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker compose must be modified for the code to compile, AWS key + AWS sender email is necessary.

"private": true,
"dependencies": {
"@aws-sdk/client-cognito-identity-provider": "^3.410.0",
"@aws-sdk/client-ses": "^3.975.0",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to add ses to the project

@@ -2,1328 +2,1346 @@
# yarn lockfile v1


Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added ses to the proejct

@piersolh piersolh marked this pull request as ready for review February 8, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Endpoint for Sending Emails

1 participant