- Removed automatic email sending on docket entry creation - Added sendNotification() method to DocketEntryController - Added route for manual notification trigger - Added 'Send Notification' button to Show page - Email now only sends when admin explicitly clicks button - Still in testing mode (chris@deafgain.org only)
6.3 KiB
6.3 KiB
Email Notification System - Deployment & Testing Guide
Overview
Email notification system has been implemented for the MAD Lawsuit v2.0 website. When a new docket entry is created via the admin dashboard, an email notification is automatically sent to subscribers.
Testing Mode Configuration
IMPORTANT: The system is currently in TESTING MODE and will ONLY send emails to chris@deafgain.org.
Testing Mode Details
- Test Recipient: chris@deafgain.org
- Purpose: Verify email functionality without spamming all 28 production subscribers
- Location:
app/Http/Controllers/Admin/DocketEntryController.php(line ~155)
Production Code (Currently Commented Out)
// Production code (commented out for testing):
// $subscribers = Subscription::where('is_active', true)->get();
// foreach ($subscribers as $subscriber) {
// Mail::to($subscriber->email)->send(
// new NewDocketEntryNotification($entry, $subscriber->unsubscribe_token)
// );
// }
Deployment Steps
1. SSH to Production Server
ssh chaulmark@10.4.0.205
2. Navigate to Project Directory
cd ~/websites/v2.mad-lawsuit.org
3. Pull Latest Code
git pull origin main
4. Rebuild Docker Container
docker compose down
docker compose up -d --build
5. Verify Container Status
docker compose ps
docker compose logs -f app
6. Clear Laravel Caches
docker exec mad-lawsuit-v2 php artisan config:clear
docker exec mad-lawsuit-v2 php artisan cache:clear
docker exec mad-lawsuit-v2 php artisan view:clear
Testing the Email System
Test Procedure
-
Login to Admin Dashboard
- URL: https://v2.mad-lawsuit.org/admin/login
- Username: eliza
- Password: AXEoZWk2AMAD0naw
-
Create a Test Docket Entry
- Navigate to "Docket Entries" → "Create New Entry"
- Fill in the form:
- Date: Today's date
- Title: "TEST - Email Notification System"
- Summary: "This is a test entry to verify email notifications are working correctly."
- Notes: (optional)
- Click "Create Docket Entry"
-
Verify Email Delivery
- Check chris@deafgain.org inbox
- Look for email with subject: "New Court Filing: TEST - Email Notification System"
- Verify email formatting and content
-
Check Logs
docker exec mad-lawsuit-v2 tail -f storage/logs/laravel.log- Look for log entries:
- "Sending email notification for new docket entry"
- "Email notification sent successfully"
- Look for log entries:
Expected Email Content
- Subject: New Court Filing: [Entry Title]
- From: MAD Lawsuit Court Docket system@deafgain.org
- To: chris@deafgain.org
- Content:
- Professional header with case name
- Filing date, title, and summary
- "View Full Docket" button linking to https://v2.mad-lawsuit.org
- Unsubscribe link (placeholder during testing)
SMTP Configuration
Gmail SMTP Settings (Already Configured in .env)
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=system@deafgain.org
MAIL_PASSWORD=ojvlysraxwjriwzy
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="system@deafgain.org"
MAIL_FROM_NAME="MAD Lawsuit Court Docket"
Gmail App Password
- Email: system@deafgain.org
- App Password: ojvlysraxwjriwzy (16-character Google App Password)
- Note: This is NOT the regular Gmail password
Switching to Production Mode
When Ready to Send to All Subscribers
-
Edit DocketEntryController.php
# On production server cd ~/websites/v2.mad-lawsuit.org nano app/Http/Controllers/Admin/DocketEntryController.php -
Update sendEmailNotifications Method (around line 155)
-
Comment out the testing code:
// TESTING MODE (comment out when ready for production) // $testEmail = 'chris@deafgain.org'; // $testToken = 'test-unsubscribe-token'; // Mail::to($testEmail)->send(new NewDocketEntryNotification($entry, $testToken)); -
Uncomment the production code:
// Production code: $subscribers = Subscription::where('is_active', true)->get(); foreach ($subscribers as $subscriber) { Mail::to($subscriber->email)->send( new NewDocketEntryNotification($entry, $subscriber->unsubscribe_token) ); }
-
-
Commit and Deploy
git add app/Http/Controllers/Admin/DocketEntryController.php git commit -m "Switch email notifications to production mode - send to all subscribers" git push origin main # On production server git pull origin main docker compose down docker compose up -d --build docker exec mad-lawsuit-v2 php artisan config:clear
Troubleshooting
Email Not Received
-
Check Laravel Logs
docker exec mad-lawsuit-v2 tail -100 storage/logs/laravel.log -
Check Gmail SMTP Connection
docker exec mad-lawsuit-v2 php artisan tinker # In tinker: Mail::raw('Test email', function($msg) { $msg->to('chris@deafgain.org')->subject('Test'); }); -
Verify .env Configuration
docker exec mad-lawsuit-v2 php artisan config:show mail
Common Issues
- Authentication Failed: Verify Gmail App Password is correct
- Connection Timeout: Check firewall rules for port 587
- SSL/TLS Errors: Ensure MAIL_ENCRYPTION=tls (not ssl)
Files Modified
New Files Created
app/Mail/NewDocketEntryNotification.php- Mailable classresources/views/emails/new-docket-entry.blade.php- HTML email template
Modified Files
app/Http/Controllers/Admin/DocketEntryController.php- Added email sending logic.env- Updated SMTP configuration
Current Status
- ✅ Email notification system implemented
- ✅ Professional HTML email template created
- ✅ SMTP configured with Gmail
- ✅ Testing mode active (chris@deafgain.org only)
- ✅ Code committed and pushed to repository
- ⏳ Awaiting deployment to production server
- ⏳ Awaiting email functionality testing
Next Steps
- Deploy to production server (10.4.0.205)
- Test email delivery to chris@deafgain.org
- Verify email formatting and content
- Once confirmed working, switch to production mode
- Update documentation with test results
Last Updated: December 18, 2025 at 10:21 AM MST
Status: Ready for deployment and testing
Git Commit: 9687b9b9