# Email Notifications
CloudPOS can send email notifications for various events. This guide covers SMTP configuration and email setup.
# Overview
Email notifications are sent for:
- Email verification (when user registers)
- Password reset requests
- Subscription confirmations
- Payment success/failure
- Subscription expiry warnings
# Step 1: Choose Email Provider
# Option 1: Gmail (Recommended for Testing)
- Free: Yes (with limitations)
- Setup: Easy
- Limits: 500 emails/day (free account)
# Option 2: SendGrid
- Free: 100 emails/day
- Setup: Moderate
- Reliability: High
# Option 3: Mailgun
- Free: 5,000 emails/month
- Setup: Moderate
- Reliability: High
# Option 4: AWS SES
- Free: 62,000 emails/month (within AWS)
- Setup: Complex
- Reliability: Very high
# Step 2: Configure SMTP Settings
# Method 1: Via Admin Panel (Recommended)
Login to Admin Panel:
http://localhost:5173/admin/loginNavigate to Settings → Email Configuration
Fill in SMTP settings:
SMTP Host:
smtp.gmail.com(for Gmail)SMTP Port:
587for TLS465for SSL
SMTP User: Your email address
SMTP Password: App password (not regular password)
Encryption:
TLSfor port 587SSLfor port 465
From Email:
noreply@yourdomain.comFrom Name:
CloudPOSToggle Is Active to enable
Click Save
# Method 2: Via Environment Variables
Add to .env file:
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
SMTP_FROM_EMAIL=noreply@cloudpos.com
SMTP_FROM_NAME=CloudPOS
Note: Admin Panel method is recommended as it's easier to update.
# Step 3: Gmail Setup (Example)
# Enable 2-Factor Authentication
- Go to: https://myaccount.google.com/security
- Enable 2-Step Verification
# Generate App Password
- Go to: https://myaccount.google.com/apppasswords
- Select app: Mail
- Select device: Other (Custom name)
- Enter:
CloudPOS - Click Generate
- Copy the 16-character password (no spaces)
- Use this in
SMTP_PASSWORD
# Configure in Admin Panel
- SMTP Host:
smtp.gmail.com - SMTP Port:
587 - SMTP User:
your-email@gmail.com - SMTP Password:
xxxx xxxx xxxx xxxx(app password, 16 chars) - Encryption:
TLS - From Email:
your-email@gmail.com(or use alias) - From Name:
CloudPOS
# Step 4: Test Email Sending
# Via Admin Panel
- Admin Panel → Settings → Email Configuration
- Click Send Test Email
- Enter test email address
- Click Send
- Check inbox (and spam folder)
# Via API (Optional)
curl -X POST http://localhost:3000/api/email/test \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-d '{"to": "test@example.com"}'
# Step 5: Email Templates
CloudPOS includes default email templates for:
- Email Verification: Sent when user registers
- Password Reset: Sent when user requests password reset
- Subscription Confirmation: Sent when subscription is activated
- Payment Success: Sent when payment succeeds
- Payment Failed: Sent when payment fails
# Customizing Templates
- Admin Panel → Settings → Email Templates
- Select template to edit
- Modify:
- Subject: Email subject line
- Body: HTML email body
- Variables: Available template variables
- Click Save
# Available Variables
Common variables in templates:
: Application name: Tenant/company name: User's name: Email verification link: Password reset link: Subscription plan name: Payment amount
# Common SMTP Configurations
# Gmail
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
# SendGrid
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=apikey
SMTP_PASSWORD=your-sendgrid-api-key
# Mailgun
SMTP_HOST=smtp.mailgun.org
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=postmaster@yourdomain.mailgun.org
SMTP_PASSWORD=your-mailgun-password
# AWS SES
SMTP_HOST=email-smtp.us-east-1.amazonaws.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-ses-smtp-username
SMTP_PASSWORD=your-ses-smtp-password
# Troubleshooting
# Emails Not Sending
Issue: No emails received
Solutions:
Check SMTP settings:
- Verify host, port, user, password
- Test with "Send Test Email" in Admin Panel
Check email logs:
# PM2 logs pm2 logs cloudpos | grep -i email # Or check server logs tail -f logs/pm2-error.logCheck spam folder:
- Emails might be in spam
- Add sender to contacts
Verify SMTP credentials:
- Test with email client (Thunderbird, Outlook)
- Use same credentials
# Authentication Failed
Error: Invalid login or Authentication failed
Solutions:
- Gmail: Use app password, not regular password
- Check username: Must be full email address
- Check password: No extra spaces
- Verify 2FA: Must be enabled for Gmail app passwords
# Connection Timeout
Error: Connection timeout or ECONNREFUSED
Solutions:
Check firewall:
- Allow outbound port 587 or 465
- Check server firewall rules
Verify SMTP host:
- Test:
telnet smtp.gmail.com 587 - Should connect (if telnet installed)
- Test:
Check port:
- Port 587 for TLS
- Port 465 for SSL
- Some providers use different ports
# Emails Going to Spam
Issue: Emails received but in spam folder
Solutions:
Configure SPF record:
- Add SPF record to DNS
- Format:
v=spf1 include:_spf.google.com ~all(for Gmail)
Configure DKIM:
- Set up DKIM signing
- Add DKIM record to DNS
Use custom domain:
- Use
noreply@yourdomain.cominstead of Gmail - Requires domain email setup
- Use
Warm up domain:
- Start with low email volume
- Gradually increase
# Rate Limiting
Issue: Emails stop sending after a few
Solutions:
Check provider limits:
- Gmail: 500/day (free)
- SendGrid: 100/day (free)
- Upgrade plan if needed
Implement queuing:
- Use email queue system
- Send emails in batches
# Disabling Email (Optional)
If you don't want to use email:
- Admin Panel → Settings → Email Configuration
- Toggle Is Active to OFF
- Or leave SMTP settings empty
Note: Some features (email verification, password reset) require email. Consider using a service like Mailtrap for development.
# Production Recommendations
- ✅ Use dedicated email service (SendGrid, Mailgun, AWS SES)
- ✅ Use custom domain for "From" address
- ✅ Configure SPF/DKIM records
- ✅ Monitor email delivery rates
- ✅ Set up email queue for high volume
- ✅ Use separate SMTP for transactional vs marketing emails
Next: See Security & Demo Mode for security best practices.