Files
timebank-cc-public/references/TEST-INACTIVE-WARNING-EMAILS.md
Ronald Huynen 2547717edb Initial commit
2026-03-23 21:37:59 +01:00

85 lines
2.1 KiB
Markdown

# Testing Inactive profile warning Emails
This guide shows you how to manually send all warning emails for testing and review.
## Quick Test (Recommended)
Run this single command to send all 3 warning emails to user ID 102:
```bash
php artisan tinker --execute="include 'send-test-warnings.php'; sendTestWarnings(102);"
```
Replace `102` with any user ID you want to test with.
## Interactive Tinker Session
For more control, use an interactive tinker session:
```bash
php artisan tinker
```
Then run:
```php
include 'send-test-warnings.php';
sendTestWarnings(102); // Replace 102 with your user ID
```
## What Gets Sent
The script will send all 3 warning emails with realistic test data:
1. **Warning 1** - "2 weeks remaining" before deletion
2. **Warning 2** - "1 week remaining" before deletion
3. **Warning Final** - "24 hours remaining" before deletion
Each email includes:
- User's current account balances
- Total balance summary
- Time remaining until deletion
- Direct login link to prevent deletion
- Support information
## Output Example
```
📧 Sending test warning emails for user: Jay.N (ID: 102)
Email: j.navarrooviedo@gmail.com
Language:
Dispatching warning_1...
Dispatching warning_2...
Dispatching warning_final...
✅ All warning emails dispatched to queue
Total balance: 2:00 H
Accounts: 1
🚀 Processing queue...
✅ Queue processed. Check your inbox at: j.navarrooviedo@gmail.com
```
## Finding User IDs
To find a user ID for testing:
```bash
php artisan tinker --execute="echo App\Models\User::where('email', 'your@email.com')->first()->id;"
```
Or list recent users:
```bash
php artisan tinker --execute="App\Models\User::latest()->take(5)->get(['id', 'name', 'email'])->each(function(\$u) { echo \$u->id . ' - ' . \$u->name . ' (' . \$u->email . ')' . PHP_EOL; });"
```
## Notes
- Emails are sent in the user's preferred language (`lang_preference`)
- All emails use the professional layout from transactional emails
- Buttons are styled in black (#111827) matching other emails
- The queue is automatically processed after dispatching
- Total balance is shown in formatted time (e.g., "2:00 H")