Skip to content

Conversation

@laurenp-2
Copy link

@laurenp-2 laurenp-2 commented Apr 30, 2025

Summary

This pull request is the first step towards implementing the email service for batch newsletter distribution.

Completed features:

  • Implemented a emailService that: retrieves users from Firebase in batches of 50, sends out emails to each batch using the Resend API. This function also supports single send emails (to a specified email address) to allow for testing of an email campaign before it is released.
  • Implemented a newsletter email template that allows easy customization.
  • Implemented a desktop and mobile view version of the newsletter (only supported in certain clients, such as Apple Mail). While the newsletter template is written to be as globally responsive as possible, note that appearance varies among different email services; a newsletter may appear differently in Gmail vs Yahoo Mail vs Outlook.

Test Plan

The backend route was tested using my email (so that no email campaigns were sent to CUApts users).

This is how a received Newsletter email appears on desktop (Gmail):
desktop 1
desktop 2
desktop 3

This is how a received newsletter appears on mobile (Apple mail app):
mobile 1
mobile 2

Note: Email clients render HTML and CSS differently, so emails may appear slightly different across inboxes. For example, Apple Mail supports custom fonts, while Gmail does not. The images above may also look different depending on the email client. Please test any emails that are being sent out vigorously among different clients to ensure consistent and responsive results!

Lauren Pothuru added 17 commits April 13, 2025 16:16
- Update backend/.eslintrc.json to reference the correct tsconfig.json path
- Enable JSX support in tsconfig.json with "jsx": "react-jsx"
- Create email sending scripts
- Create basic components for newsletter
- Create assets folder in email directory
- Add email icons to assets
- Create Newsletter templates
- Create components for newsletter sections
- Create generateNewsletter component to allow customization
- Update README (WIP)
- Update emailService to mail newsletter created by GenerateNewsletter
- Edit tsconfig to allow JSX in react files
- Add working directory configuration in eslintrc to prevent parsing errors

- TODO: figure out why these errors keep on occuring
- Create ReelsFeature, SubleaseSpotlight, FeatureSpotlight and NeighborhoodComparison components
- Edit styling of existing newsletter components
- Add prop types for new components to Types.tsx
- Add new components to Newsletter template
- Add customization options for new components in GenerateNewsletter
- Implement all components of Newsletter
- Render property cards in AreaSpotlight and LandlordHighlight (based on property id)

- TODO: finish styling, add documentation
- Add top-level documentation to all Newsletter components
- Load firebase users in batches of 50
- Implement script to send emails out to all users in loaded batches
- Update README for email directory
- Update import in firebase_users_loader
@laurenp-2 laurenp-2 requested a review from ggsawatyanon April 30, 2025 01:38
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Lauren Pothuru seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Lauren Pothuru added 3 commits April 30, 2025 10:02
- Fix relative vs absolute path in property fetch
- Add info to README
@CasperL1218 CasperL1218 self-requested a review May 4, 2025 22:29
CasperL1218
CasperL1218 previously approved these changes May 4, 2025
Copy link
Contributor

@CasperL1218 CasperL1218 left a comment

Choose a reason for hiding this comment

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

This PR is comprehensive with a lot of detailed carried out well. Here are some main points to note:

  1. The README file is very informative and thorough. The "important" notices are helpful!
  2. For the styling of component, you could organize them with useStyle, which could make styling more intuitive and clear, and mainly more reusable. You could checkout the other files to see how it is done. (this is more of a code pattern issue, this could be done next semester on a separate task by you or someone else so no worries now)
  3. For backend/scripts/email/emailService.ts file, you have some commented out logic from line 84 to 92. It would be nice to remove them if they are no longer needed

Lauren Pothuru added 2 commits August 26, 2025 10:34
- Abstract unnecessary comments and clean up code
- Fix environment variable handling in firebase config
- Update README for clarity and formatting
@dti-github-bot
Copy link
Member

dti-github-bot commented Aug 26, 2025

[diff-counting] Significant lines: 2215. This diff might be too big! Developer leads are invited to review the code.

- Update image icons for better compatibility
- Add mobile header; prevent dark mode (only supported in some email clients)
- Abstract email sending into separate functions
@laurenp-2 laurenp-2 changed the title WIP- Newsletter Newsletter Sep 2, 2025
@laurenp-2 laurenp-2 changed the title Newsletter Email Broadcasting Service and General Newsletter template Sep 2, 2025
@laurenp-2 laurenp-2 changed the title Email Broadcasting Service and General Newsletter template Batch Newsletter Service Sep 2, 2025
@CasperL1218 CasperL1218 self-requested a review September 22, 2025 03:12
Copy link
Contributor

Choose a reason for hiding this comment

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

Great implementation with good structured code and layout.
After conducting the testings, you could organize the test cases in a separate testing files to better separate feature and test files.

Copy link
Contributor

@CasperL1218 CasperL1218 left a comment

Choose a reason for hiding this comment

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

Great implementation of the html template with the approach to resolve the preloading issues.
Some small details to clean up wrapping up include a brief check of removing unused/commented-out sections, organizing testing functions into a separata testing file for code quality and organization.

Looking forward to the new design updates and the admin end input! Good job!

@laurenp-2 laurenp-2 changed the title Batch Newsletter Service <WIP> Batch Newsletter Service Sep 23, 2025
@laurenp-2 laurenp-2 changed the title <WIP> Batch Newsletter Service Batch Newsletter Service Oct 1, 2025
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.

5 participants