Overview
Dashboard Dilemas sends automated emails for:- Completion certificates (participation and excellence awards)
- Activity reminders for incomplete dilemmas
- User notifications and alerts
SMTP Configuration
Basic Setup
Configure SMTP settings inincludes/config.php:
includes/config.php
Recommended Providers
Brevo
Free tier: 300 emails/dayHost:
smtp-relay.brevo.comPort: 587 (TLS)SendGrid
Free tier: 100 emails/dayHost:
smtp.sendgrid.netPort: 587 (TLS)Gmail
Requires App PasswordHost:
smtp.gmail.comPort: 587 (TLS)Provider-Specific Configuration
WordPress Integration
The email system requires WordPress’s PHPMailer library. Configure the WordPress path:includes/config.php
PHPMailer Implementation
The application uses PHPMailer with SMTP authentication:cron_email_reminders.php
If WordPress PHPMailer is not available, the system falls back to PHP’s native
mail() function.Email Types
Certificate Emails
Sent when users complete dilemmas, triggered byapi_send_certificate.php.
Participation Certificate
- Subject: ”📜 Tu Certificado de Participación - [Game Name]”
- Content: Professional HTML template with download button
- Certificate URL:
SITE_URL/generate_certificate.php?user_id=X&game_id=Y&type=participation
Excellence Award Certificate
- Subject: ”🏆 ¡Felicidades! Tu Certificado de Excelencia - [Game Name]”
- Content: Congratulatory message for outstanding performance
Reminder Emails
Automated reminders for users with incomplete dilemmas, sent viacron_email_reminders.php.
Configuration
Cron Setup
Parameters
| Parameter | Default | Description |
|---|---|---|
secret | (required) | Cron secret for authentication |
days | 7 | Days of inactivity before reminder |
dry_run | false | Test mode - logs without sending |
Testing Reminders
Reminder emails are limited to 50 recipients per execution to prevent SMTP throttling.
Email Templates
Certificate Email Template
The certificate email uses a responsive HTML template with gradient header:api_send_certificate.php
Reminder Email Template
Reminder emails feature a professional design encouraging completion:cron_email_reminders.php
Monitoring and Logging
Email Logs
Cron job execution logs are stored in:Log Format
Certificate Sending Audit
Certificate emails are tracked in the database:Troubleshooting
SMTP authentication failed
SMTP authentication failed
Symptoms: Emails not sending, SMTP errors in logs.Solutions:
- Verify
SMTP_USERandSMTP_PASSare correct - For Gmail, ensure you’re using an App Password, not your account password
- Check that your SMTP provider hasn’t blocked your IP
- Verify
SMTP_PORTandSMTP_SECUREmatch your provider’s requirements
WordPress not found error
WordPress not found error
Symptoms: “WordPress not found at /path/to/wordpress” error.Solutions:
- Update
WP_PATHinincludes/config.phpto your actual WordPress directory - Ensure the path is absolute, not relative
- Verify the web server has read permissions for that directory
- Check that
wp-includes/class-phpmailer.phpexists in that path
Emails going to spam
Emails going to spam
Symptoms: Users not receiving emails, found in spam folder.Solutions:
- Configure SPF and DKIM records for your domain
- Use a verified sender email address
- Ensure
SMTP_FROM_EMAILmatches your domain - Avoid spam trigger words in subject lines
- Use a reputable SMTP provider (Brevo, SendGrid)
Cron job not running
Cron job not running
Symptoms: No reminder emails sent, no new log entries.Solutions:
- Verify cron job is properly configured in your server’s crontab
- Test manually:
curl "https://yourdomain.com/cron_email_reminders.php?secret=YOUR_SECRET" - Check that the
secretparameter matchesCRON_SECRET - Ensure the script has execute permissions
- Check web server error logs for PHP errors
Rate limiting / throttling
Rate limiting / throttling
Symptoms: Some emails send, others fail after a certain number.Solutions:
- Check your SMTP provider’s rate limits
- Reduce
MAX_EMAILSconstant incron_email_reminders.php(default: 50) - Upgrade to a paid tier for higher limits
- Implement delays between emails if needed
Testing Email Configuration
Test Certificate Email
Send a test certificate to verify SMTP configuration:Test Reminder Email (Dry Run)
Test reminder logic without sending actual emails:Security Considerations
Secure Cron Secret
Generate a strong cron secret:Next Steps
Database Configuration
Set up MySQL database schema
Environment Variables
Configure application settings