Settings - Mail
Configure SMTP servers, mail spooling, and email delivery settings
Overview
The Mail Settings page controls how ColdFusion sends email via the cfmail tag. You can configure multiple SMTP servers for redundancy, set up mail spooling for asynchronous delivery, configure authentication and encryption, and manage mail queue behavior. Proper configuration ensures reliable email delivery and optimal performance.
SMTP Server Configuration
Configure primary and backup SMTP servers for email delivery.
Mail Server (SMTP)
smtp.example.com, smtp.gmail.com, mail.privateemail.comServer Port
587 - Submission port with STARTTLS (recommended)
465 - SMTPS (implicit SSL/TLS, legacy)
2525 - Alternative submission port
Username & Password
Use SSL/TLS Connection
SSL: Encrypted from start (port 465)
Verify Connection
Mail Spool Settings
Configure asynchronous email processing and queue management.
Enable Mail Spool
Automatic retry on delivery failures
Better handling of SMTP server issues
Rate limiting and throttling capabilities
Spool Interval (seconds)
High Volume: 1-5 seconds
Low Volume: 30-60 seconds
Maximum Number of Messages to Deliver Per Spool Interval
Spool Mail Directory
cfusion/mail/spoolDelivery Failure Settings
Control retry behavior and handling of failed email delivery.
Maximum Number of Delivery Attempts
Retry Interval (seconds)
Undelivered Message Directory
cfusion/mail/undelivrAdvanced Settings
Configure additional mail server options and logging.
Default Mail Server
- Purpose
- Primary server used when multiple servers are configured
- Behavior
- Falls back to backup servers if primary fails
- Recommendation
- Set your most reliable server as default
Enable Backup Mail Server
- Purpose
- Add redundant SMTP servers for failover
- Recommendation
- Configure backup server for high-availability
Use different providers/infrastructure for true redundancy. Example: Primary = internal relay, Backup = external service (SendGrid, SES)
Mail Character Set
- Default
- UTF-8
- Recommendation
- Always use UTF-8 for international character support
Default character encoding for email messages. Can be overridden per-message in cfmail tag.
Sign Messages
- Default
- Disabled
- Use Case
- Required for certain compliance scenarios
- Requirement
- Must configure keystore and certificate
Digitally sign outgoing emails with certificate for compliance and security.
Mail Logging
- Default
- Error level
- Recommendation
- Information for production, Debug for troubleshooting
- Location
- cfusion/logs/mail.log
Log mail operations including SMTP transactions, delivery attempts, and errors.
Popular SMTP Provider Settings
Quick reference for common email service provider configurations.
Gmail / Google Workspace
- Server
- smtp.gmail.com
- Port
- 587 (TLS enabled)
- Authentication
- Email address and App Password
- Limit
- 500/day (Gmail), higher for Workspace
Must use App Passwords, not regular password. Enable "Less secure app access" if needed.
Microsoft 365 / Outlook.com
- Server
- smtp-mail.outlook.com or smtp.office365.com
- Port
- 587 (TLS enabled)
- Authentication
- Full email address and password
- Limit
- 300/day (Outlook), 10,000/day (M365)
SendGrid
- Server
- smtp.sendgrid.net
- Port
- 587 or 2525 (TLS enabled)
- Username
- apikey (literal string)
- Password
- Your SendGrid API key
- Limit
- 100/day free, 100/second paid
Amazon SES
- Server
- email-smtp.us-east-1.amazonaws.com
- Port
- 587 (TLS enabled)
- Credentials
- SMTP username/password from SES console
Region-specific endpoint. Start in sandbox mode, request production access.
Mailgun
- Server
- smtp.mailgun.org
- Port
- 587 (TLS enabled)
- Username
- postmaster@your-domain.mailgun.org
- Password
- SMTP password from Mailgun dashboard
Best Practices
Production Environment
- Always enable mail spooling for async delivery
- Configure backup SMTP server for redundancy
- Use TLS encryption for all SMTP connections
- Set spool interval based on volume (5-15 seconds typical)
- Monitor undelivered mail directory for delivery issues
- Configure appropriate rate limiting for your SMTP provider
- Use dedicated SMTP service (SendGrid, SES) for high volume
- Implement SPF, DKIM, and DMARC records for deliverability
- Monitor mail.log for errors and delivery failures
Development Environment
- Use mail capture tools (MailHog, Papercut) to avoid sending real emails
- Configure test SMTP server separate from production
- Set longer spool intervals to reduce processing overhead
- Enable debug logging to troubleshoot issues
Security Considerations
- Always use authentication - never allow anonymous relay
- Enable TLS/SSL encryption to protect credentials
- Use app-specific passwords instead of primary account passwords
- Restrict SMTP relay to authorized IP addresses when possible
- Implement rate limiting to prevent email flooding
- Validate email addresses to prevent injection attacks
- Monitor for unusual sending patterns indicating compromise
- Rotate SMTP credentials periodically
Performance Tuning
- Enable mail spooling to prevent cfmail from blocking requests
- Adjust spool interval based on volume and latency requirements
- Increase messages per interval for high-volume applications
- Use multiple SMTP servers to distribute load
- Monitor spool directory size - large queues indicate issues
- Consider external mail service for bulk sending
Common Issues and Solutions
Email Not Sending
- Symptom: cfmail executes but emails never arrive
- Check: SMTP server settings, authentication, port accessibility
- Solution: Use "Verify Connection" to test configuration
- Firewall: Ensure SMTP ports (587, 465, 25) are not blocked
- Logs: Check mail.log for connection errors
Authentication Failed
- Symptom: "Authentication failed" error in mail.log
- Gmail: Use App Password, enable "Less secure app access"
- Office 365: Verify SMTP AUTH is enabled for mailbox
- Solution: Double-check username, password, and authentication method
Emails Going to Spam
- Symptom: Emails delivered but marked as spam
- SPF Record: Add SMTP server to SPF record
- DKIM: Configure DKIM signing for authentication
- DMARC: Implement DMARC policy
- Content: Avoid spam trigger words, include unsubscribe link
- Reputation: Use reputable SMTP service, warm up IP address
Spool Queue Growing
- Symptom: Thousands of files in spool directory
- Cause: SMTP server unavailable or rate limiting too aggressive
- Solution: Check SMTP connectivity, increase messages per interval
- Emergency: Temporarily disable rate limiting to clear backlog
- Prevention: Monitor queue depth, alert on growth
Slow Page Performance
- Symptom: Pages with cfmail tag load slowly
- Cause: Mail spooling disabled, sending synchronously
- Solution: Enable mail spooling for async delivery
- Alternative: Use cfthread for immediate sending without blocking
Connection Timeout
- Symptom: "Connection timeout" errors
- Firewall: SMTP port blocked by firewall or security group
- Network: Network connectivity issues
- Solution: Verify port accessibility using telnet or nc
- Test: telnet smtp.example.com 587
Monitoring and Maintenance
Daily Monitoring
- Check spool directory size - should be near empty
- Review mail.log for errors
- Monitor undelivered directory for failed messages
- Track email delivery metrics (sent, failed, bounced)
Weekly Maintenance
- Review undelivered messages, investigate patterns
- Archive or delete old mail.log files
- Check for mail server connectivity issues
- Verify backup SMTP server is functional
Alerts to Configure
- Spool queue exceeds 100 messages
- Undelivered directory exceeds 50 messages
- SMTP connection failures exceed threshold
- Mail.log shows authentication failures