This guide covers email notification setup and management.
SMTP Configuration
Access Email Settings
- Sign in as an admin
- Navigate to Settings > Email
Configure SMTP Server
Fill in your SMTP server details:
| Field | Description | Common Values |
|---|---|---|
| SMTP Host | Mail server address | smtp.gmail.com, smtp-mail.outlook.com |
| SMTP Port | Server port | 587 (TLS), 465 (SSL), 25 (unencrypted) |
| Username | Authentication email | your-email@domain.com |
| Password | SMTP password | App-specific password recommended |
| From Email | Sender address | noreply@company.com |
| From Name | Display name | CHRIS HR System |
| Use TLS | Enable encryption | Yes (recommended) |
Provider-Specific Setup
=== "Gmail"
1. Enable 2-factor authentication on your Google account
2. Create an [App Password](https://myaccount.google.com/apppasswords)
3. Use these settings:
- Host: `smtp.gmail.com`
- Port: `587`
- TLS: Enabled
- Username: Your Gmail address
- Password: The 16-character app password
=== "Outlook/Microsoft 365"
1. Create an [App Password](https://account.live.com/proofs/AppPassword)
2. Use these settings:
- Host: `smtp-mail.outlook.com`
- Port: `587`
- TLS: Enabled
- Username: Your Outlook address
- Password: The app password
=== "Custom SMTP"
Consult your email provider's documentation for:
- SMTP host address
- Required port
- Authentication method
- TLS/SSL requirements
Test Configuration
- Click Send Test Email
- A test email will be sent to your logged-in email address
- Check your inbox (and spam folder)
- If successful, you'll see a green confirmation
!!! failure "Test Failed?" Common issues:
- Wrong password (use app-specific password)
- Incorrect port for TLS setting
- Firewall blocking outbound SMTP
- Account requires additional verification
Email Templates
View Available Templates
Navigate to Settings > Email Templates:
| Template | Trigger | Recipients |
|---|---|---|
| Leave Request Submitted | New request created | Team leaders, HR |
| Leave Request Approved | Request approved | Employee |
| Leave Request Rejected | Request rejected | Employee |
| Welcome Email | New employee created | New employee |
| Password Reset | Password reset requested | Employee |
Edit a Template
- Click on a template to edit
- Modify the content:
- Subject: Email subject line
- Body: HTML email content
- Use placeholders for dynamic content
- Click Save
Available Placeholders
Use these in templates with double curly braces:
| Placeholder | Description |
|---|---|
{{employee_name}} |
Full name of the employee |
{{employee_email}} |
Employee's email address |
{{leave_type}} |
Type of leave requested |
{{start_date}} |
Leave start date |
{{end_date}} |
Leave end date |
{{working_days}} |
Number of working days |
{{status}} |
Request status |
{{approver_name}} |
Name of person who approved/rejected |
{{comments}} |
Approver's comments |
Example Template
<h2>Leave Request {{status}}</h2>
<p>Dear {{employee_name}},</p>
<p>Your leave request has been <strong>{{status}}</strong>.</p>
<ul>
<li>Type: {{leave_type}}</li>
<li>Dates: {{start_date}} - {{end_date}}</li>
<li>Working Days: {{working_days}}</li>
</ul>
<p>Decision by: {{approver_name}}</p>
{{#if comments}}
<p>Comments: {{comments}}</p>
{{/if}}
Email Rerouting
Use email rerouting during testing to prevent sending to real users.
Enable Rerouting
- Go to Settings > Email
- Toggle Enable Email Rerouting to on
- Enter a Reroute Address (e.g., testing@yourcompany.com)
- Click Save
All notification emails will now go to the reroute address instead of actual recipients.
When to Use Rerouting
- Initial system setup
- Testing email templates
- Staging environment
- Training sessions
Disable for Production
!!! warning "Remember to Disable" Before going live, ensure email rerouting is disabled so notifications reach actual recipients.
Troubleshooting
Emails Not Sending
- Check SMTP credentials: Verify host, port, username, password
- Verify TLS setting: Some servers require TLS, others don't
- Check Edge Function logs: Supabase Dashboard > Functions > send-notification-email > Logs
- Test with minimal settings: Try with a simple SMTP provider first
Emails Going to Spam
- Ensure "From Email" matches your domain
- Set up SPF/DKIM records for your domain
- Avoid spam trigger words in subjects
- Use a reputable SMTP provider
Template Variables Not Replacing
- Check placeholder syntax:
{{variable_name}} - Verify the variable exists in the template context
- Check for typos in variable names
Rate Limiting
Some providers limit email frequency:
| Provider | Typical Limit |
|---|---|
| Gmail | 500/day |
| Outlook | 300/day |
| SendGrid | Varies by plan |
For high-volume needs, consider a dedicated email service like SendGrid, Mailgun, or Amazon SES.