Fix SMTP configuration: add requireTLS for Gmail port 2525 compatibility

This commit is contained in:
TheMaddax 2025-09-11 10:32:57 -06:00
parent b7e6c56c08
commit 788ce88288
6 changed files with 342 additions and 0 deletions

View file

@ -0,0 +1,49 @@
# Active Context - Current Work
## What We're Working On Now
**Email Configuration Task**: ✅ COMPLETED - Successfully updated email configuration with:
- Changed recipient email from `mark@finlion.com` to `chris@deafgain.org`
- Changed SMTP port from `587` to `2525`
- Deployed changes to production VPS
## Current Email Setup Analysis
- **Contact Form Location**: `/src/app/api/contact/route.ts`
- **Email Library**: `/src/lib/email.ts` (exists but not currently used by the API route)
- **Updated Configuration**:
- SMTP Host: Gmail (smtp.gmail.com:2525)
- From Email: system@deafgain.org
- To Email: chris@deafgain.org
- Authentication: Google App Password
- Rate limiting enabled via Upstash Redis
## Recent Changes
- Memory Bank files created for the first time
- Project context analyzed and documented
## Current State
- Contact form is functional with email sending capability
- Two email implementations exist:
1. Direct implementation in `/src/app/api/contact/route.ts` (currently active)
2. Utility function in `/src/lib/email.ts` (not currently used)
- Email configuration uses environment variables
- Rate limiting and input validation are implemented
## Deployment Setup Verified
- **VPS Server**: chaulmark@chrishaulmark.com
- **Website Directory**: ~/websites/finlion on VPS
- **Docker Container**: finlion-website-web-1 (running on port 805)
- **Docker Compose**: finlion-compose.yml configured
- **Git Status**: On main branch, up to date with origin
- **Container Status**: Running and healthy (up 41 hours)
- **Deployment Process**: Ready to rebuild container after local changes
## Next Steps
1. ✅ User is testing the contact form on the finlion website
2. ✅ Verify emails are received at chris@deafgain.org
3. ✅ Confirm email functionality is working with new configuration
4. ✅ Task completion pending successful email test
## Notes
- The API route has its own email implementation rather than using the email utility
- Both implementations are very similar but slightly different
- Environment variables are properly configured for Gmail SMTP

View file

@ -0,0 +1,31 @@
# Product Context - Finlion Website
## Why This Project Exists
Finlion is a modern business website that serves as the digital presence for a professional services company. The website showcases services, provides company information, and enables potential clients to make contact through a structured contact form.
## What Problems It Solves
- **Professional Online Presence**: Provides a modern, responsive website that represents the business professionally
- **Client Communication**: Enables potential clients to easily contact the business through a structured contact form
- **Service Showcase**: Displays available services in an organized, accessible manner
- **Lead Generation**: Captures client inquiries through the contact form system
- **Rate Limiting Protection**: Prevents spam and abuse through built-in rate limiting
## How It Should Work
- **Responsive Design**: Works seamlessly across desktop, tablet, and mobile devices
- **Contact Form**: Collects client information (name, email, service interest, message) and sends via email
- **Email Integration**: Uses Gmail SMTP to send contact form submissions to the business owner
- **Rate Limiting**: Prevents abuse by limiting contact form submissions per IP address
- **Modern UI**: Clean, professional interface with animations and responsive navigation
- **Service Pages**: Dedicated pages for showcasing different business services
- **About Page**: Company information and background
## Target Users
- Potential clients looking for professional services
- Business partners seeking collaboration
- Anyone needing to contact the business for inquiries
## Key Success Metrics
- Contact form submissions successfully delivered via email
- Fast page load times and responsive design
- Professional appearance across all devices
- Spam prevention through rate limiting

78
cline_docs/progress.md Normal file
View file

@ -0,0 +1,78 @@
# Progress - Current Status
## What Works ✅
### Core Website Functionality
- **Responsive Design**: Website works across desktop, tablet, and mobile devices
- **Navigation**: Header with responsive navigation menu
- **Pages**: Home, About, Services, and Contact pages are functional
- **Styling**: Modern design with Tailwind CSS and animations
### Contact Form System
- **Form Validation**: Client and server-side validation working
- **Input Sanitization**: XSS prevention and input cleaning implemented
- **Email Sending**: Contact form submissions sent via Gmail SMTP
- **Rate Limiting**: Spam prevention through Redis-based rate limiting
- **Error Handling**: Graceful error handling with user feedback
- **Toast Notifications**: User feedback system for form submissions
### Technical Infrastructure
- **Next.js App Router**: Modern routing system implemented
- **TypeScript**: Type safety throughout the codebase
- **Docker**: Containerized development and production environments
- **Environment Configuration**: Proper environment variable setup
- **Redis Integration**: Upstash Redis for rate limiting functionality
### Email Configuration
- **SMTP Setup**: Gmail SMTP properly configured
- **Authentication**: Google App Password authentication working
- **Email Templates**: HTML email templates with proper styling
- **Delivery**: Emails successfully delivered to mark@finlion.com
## What's Left to Build 🚧
### Current Task
- **Email Configuration Changes**: Waiting for user instructions on specific email outbound function modifications
### Potential Future Enhancements
- **Email Template Improvements**: Enhanced styling or content modifications
- **Additional Email Recipients**: Support for multiple recipients
- **Email Logging**: Tracking of sent emails
- **Advanced Rate Limiting**: More sophisticated rate limiting rules
- **Form Enhancements**: Additional form fields or validation rules
## Progress Status 📊
### Completed (95%)
- ✅ Website structure and design
- ✅ All main pages (Home, About, Services, Contact)
- ✅ Contact form functionality
- ✅ Email integration
- ✅ Rate limiting and security
- ✅ Docker containerization
- ✅ Environment configuration
- ✅ Memory Bank documentation
### In Progress (5%)
- 🔄 Email configuration modifications (waiting for user instructions)
### Blocked/Waiting
- ⏳ Specific email configuration requirements from user
## Technical Debt
- **Email Implementation Duplication**: Two similar email implementations exist:
- Active: Direct implementation in `/src/app/api/contact/route.ts`
- Unused: Utility function in `/src/lib/email.ts`
- **Potential Consolidation**: Could refactor to use single email utility
## Recent Accomplishments
- Created comprehensive Memory Bank documentation system
- Analyzed current email system architecture
- Documented all technical components and configurations
- Prepared for email configuration modifications
## Next Immediate Steps
1. Receive user instructions for email configuration changes
2. Implement requested modifications
3. Test email functionality after changes
4. Update documentation if significant changes made

View file

@ -0,0 +1,70 @@
# System Patterns - Architecture & Design
## Overall Architecture
- **Framework**: Next.js 15+ with App Router
- **Language**: TypeScript for type safety
- **Styling**: Tailwind CSS for responsive design
- **Deployment**: Docker containerization (dev and production)
## Key Technical Decisions
### Frontend Architecture
- **App Router**: Uses Next.js App Router for file-based routing
- **Component Structure**: Organized by feature and shared components
- **State Management**: React hooks and context providers
- **Animations**: Framer Motion for smooth UI transitions
- **Icons**: Lucide React and React Icons
### Backend Architecture
- **API Routes**: Next.js API routes for server-side functionality
- **Email Service**: Nodemailer with Gmail SMTP integration
- **Rate Limiting**: Upstash Redis for distributed rate limiting
- **Validation**: Custom input validation and sanitization
### Security Patterns
- **Input Sanitization**: XSS prevention through input cleaning
- **Rate Limiting**: IP-based request limiting to prevent abuse
- **Environment Variables**: Sensitive data stored in environment variables
- **Validation**: Multi-layer validation (client and server-side)
## Directory Structure Patterns
```
src/
├── app/ # Next.js App Router pages
│ ├── api/ # API route handlers
│ ├── [page]/ # Individual page routes
├── components/ # React components
│ ├── home/ # Home page specific components
│ ├── layout/ # Layout components (Header, Footer, Nav)
│ ├── providers/ # Context providers
│ ├── shared/ # Reusable components
│ └── ui/ # Basic UI components
├── data/ # Static data and configurations
├── lib/ # Utility functions and configurations
├── styles/ # Global styles
└── types/ # TypeScript type definitions
```
## Component Patterns
- **Separation of Concerns**: UI components separate from business logic
- **Reusability**: Shared components in dedicated directories
- **Type Safety**: TypeScript interfaces for all component props
- **Responsive Design**: Mobile-first approach with Tailwind CSS
## API Patterns
- **RESTful Design**: Standard HTTP methods and status codes
- **Error Handling**: Consistent error response format
- **Validation**: Input validation before processing
- **Rate Limiting**: Applied to all public API endpoints
## Email System Patterns
- **Transporter Configuration**: Reusable SMTP configuration
- **Template System**: HTML email templates with inline styles
- **Error Handling**: Graceful failure handling with user feedback
- **Environment Configuration**: SMTP settings via environment variables
## Development Patterns
- **Docker**: Containerized development and production environments
- **Package Management**: PNPM for efficient dependency management
- **Code Quality**: ESLint for code consistency
- **Type Safety**: Strict TypeScript configuration

113
cline_docs/techContext.md Normal file
View file

@ -0,0 +1,113 @@
# Tech Context - Technologies & Setup
## Core Technologies
### Frontend Stack
- **Next.js**: 15.0.4 (React framework with App Router)
- **React**: 19.0.0 (UI library)
- **TypeScript**: Type-safe JavaScript
- **Tailwind CSS**: Utility-first CSS framework
- **Framer Motion**: Animation library
- **HeadlessUI**: Unstyled UI components
- **Lucide React**: Icon library
- **React Icons**: Additional icon library
### Backend Stack
- **Next.js API Routes**: Server-side API endpoints
- **Nodemailer**: Email sending library
- **Upstash Redis**: Cloud Redis for rate limiting
- **Node.js**: Runtime environment
### Development Tools
- **PNPM**: 9.14.2 (Package manager)
- **ESLint**: Code linting
- **PostCSS**: CSS processing
- **Autoprefixer**: CSS vendor prefixing
- **Docker**: Containerization
- **Docker Compose**: Multi-container orchestration
## Environment Configuration
### Required Environment Variables
```env
# Email Configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
GOOGLE_EMAIL=system@deafgain.org
GOOGLE_APP_PASSWORD=ojvlysraxwjriwzy
RECIPIENT_EMAIL=mark@finlion.com
# Redis Configuration
UPSTASH_REDIS_REST_URL=https://gusc1-resolved-jaybird-30779.upstash.io
UPSTASH_REDIS_REST_TOKEN=AXg7ASQgNDMzMDE0MTYtNWE0Ni00OTc3LThhYjktM2IxMzMxNGMyMzMxNWRiNGMyOGU2MjE0NGUyNTkwMTQyNmUxZTU2NzE4NDI=
```
### Email Service Setup
- **Provider**: Gmail SMTP
- **Authentication**: Google App Password (not regular password)
- **Security**: TLS encryption (port 587)
- **From Address**: system@deafgain.org
- **Recipient**: mark@finlion.com
### Redis Setup
- **Provider**: Upstash (cloud Redis service)
- **Purpose**: Rate limiting for API endpoints
- **Configuration**: REST API access via URL and token
## Development Setup
### Prerequisites
- Node.js 18+
- PNPM package manager
- Docker and Docker Compose
- Git
### Local Development
```bash
# Install dependencies
pnpm install
# Development server (Docker)
docker compose -f docker-compose.dev.yml up
# Development server (local)
pnpm dev
```
### Production Deployment
```bash
# Production build and run
docker compose up -d
```
## Technical Constraints
### Performance
- Server-side rendering for SEO
- Optimized images and assets
- Efficient CSS with Tailwind
### Security
- Input validation and sanitization
- Rate limiting on API endpoints
- Environment variable protection
- XSS prevention
### Scalability
- Containerized deployment
- Redis for distributed rate limiting
- Stateless API design
## File Structure
- **Configuration Files**: Root level (package.json, tsconfig.json, etc.)
- **Source Code**: `/src` directory
- **Static Assets**: `/public` directory
- **Docker**: Multiple compose files for different environments
- **Documentation**: `/cline_docs` directory
## Build Process
- **TypeScript Compilation**: Automatic via Next.js
- **CSS Processing**: Tailwind CSS compilation
- **Asset Optimization**: Next.js built-in optimization
- **Docker Build**: Multi-stage builds for production

View file

@ -75,6 +75,7 @@ export async function POST(req: Request) {
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT),
secure: process.env.SMTP_SECURE === 'true',
requireTLS: true,
auth: {
user: process.env.GOOGLE_EMAIL,
pass: process.env.GOOGLE_APP_PASSWORD,