- Fixed malformed WEEKLY_EMAIL_RECIPIENT in .env file - Added email address validation to prevent malformed emails - Enhanced logging for better debugging - Updated email service to use Firebase config in production with env var fallback - Added proper error handling for invalid email formats - Deployed fixes to resolve 500 error on weekly email functionality
2.7 KiB
2.7 KiB
Email Configuration Setup
Overview
This application uses environment variables for email configuration instead of Firebase Functions config (which is being deprecated).
Required Environment Variables
Email Server Configuration
EMAIL_HOST- SMTP server host (default: smtp.gmail.com)EMAIL_PORT- SMTP server port (default: 587)EMAIL_SECURE- Use secure connection (default: false)EMAIL_USER- SMTP username/emailEMAIL_PASS- SMTP password or app passwordEMAIL_FROM- From email address (default: noreply@cim-summarizer.com)
Weekly Email Recipients
WEEKLY_EMAIL_RECIPIENT- Email address for weekly summary reports (default: jpressnell@bluepointcapital.com)
Setup Instructions
For Local Development
- Create a
.envfile in the backend directory - Add the required environment variables:
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_SECURE=false
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
EMAIL_FROM=noreply@cim-summarizer.com
WEEKLY_EMAIL_RECIPIENT=recipient@example.com
For Firebase Functions (Production)
- Set environment variables using Firebase CLI:
firebase functions:config:set email.host="smtp.gmail.com"
firebase functions:config:set email.port="587"
firebase functions:config:set email.secure="false"
firebase functions:config:set email.user="your-email@gmail.com"
firebase functions:config:set email.pass="your-app-password"
firebase functions:config:set email.from="noreply@cim-summarizer.com"
firebase functions:config:set email.weekly_recipient="recipient@example.com"
- IMPORTANT: After December 31, 2025, you must migrate to environment variables:
firebase functions:config:unset email
And set environment variables instead:
firebase functions:secrets:set EMAIL_HOST
firebase functions:secrets:set EMAIL_PORT
firebase functions:secrets:set EMAIL_SECURE
firebase functions:secrets:set EMAIL_USER
firebase functions:secrets:set EMAIL_PASS
firebase functions:secrets:set EMAIL_FROM
firebase functions:secrets:set WEEKLY_EMAIL_RECIPIENT
Gmail Setup (Recommended)
- Enable 2-factor authentication on your Gmail account
- Generate an App Password:
- Go to Google Account settings
- Security → 2-Step Verification → App passwords
- Generate a password for "Mail"
- Use the generated password as
EMAIL_PASS
Testing
Use the test script to verify email configuration:
cd backend
npm run test:email
Migration from functions.config()
The application has been updated to use environment variables directly instead of functions.config(). This change ensures compatibility after the Firebase Functions configuration API is deprecated on December 31, 2025.