Email Delivery & SMTP Monitoring: Mail Queue and Port 25
Email Delivery & SMTP Monitoring: Mail Queue and Port 25
Email delivery monitoring is essential for ensuring reliable email communication and maintaining business operations. This comprehensive guide covers everything you need to know about monitoring email delivery, SMTP server performance, and email queue status.
For troubleshooting email issues, see Email Delivery Failures and SMTP Errors. For monitoring email queue, see Monitor Email Queue and SMTP Status.
Why Email Delivery Monitoring Matters
Email is critical for business communication, notifications, and user engagement. Email delivery failures can cause missed communications, notification failures, and poor user experience. Monitoring email delivery ensures reliable email service.
Effective email monitoring enables you to:
- Track email delivery success rates
- Monitor SMTP server performance
- Detect email delivery failures early
- Monitor email queue status
- Ensure reliable email delivery
- Optimize email server configuration
Key Email Metrics to Monitor
Delivery Metrics
- Delivery Success Rate: Percentage of successfully delivered emails
- Bounce Rate: Percentage of bounced emails
- Delivery Time: Time to deliver emails
- Queue Size: Number of emails in queue
SMTP Metrics
- SMTP Server Availability: SMTP server uptime
- SMTP Response Time: Time for SMTP server to respond
- SMTP Error Rate: Percentage of SMTP errors
- SMTP Connection Failures: Failed SMTP connections
Queue Metrics
- Queue Length: Number of emails waiting
- Queue Processing Rate: Emails processed per minute
- Queue Age: Age of oldest email in queue
- Queue Growth Rate: Rate of queue growth
Method 1: Monitor Email Queue Status
Check Postfix Queue
# Check email queue length
mailq | wc -l
# View emails in queue
mailq
# Check queue details
postqueue -p
# Count emails in queue
postqueue -p | grep -c "^[A-F0-9]"
Check Sendmail Queue
# Check sendmail queue
mailq
# View queue details
sendmail -bp
# Count emails in queue
mailq | grep -c "^[A-F0-9]"
Monitor Queue Size Over Time
# Track queue size
while true; do
echo "$(date): $(mailq | wc -l) emails in queue"
sleep 60
done
Method 2: Monitor SMTP Server Status
Test SMTP Connection
# Test SMTP server connection
telnet smtp.example.com 25
# Test SMTP with timeout
timeout 5 telnet smtp.example.com 25
# Check SMTP server response
echo "QUIT" | telnet smtp.example.com 25
Check SMTP Server Logs
# View SMTP logs (Postfix)
sudo tail -f /var/log/mail.log | grep smtp
# View SMTP errors
sudo grep -i error /var/log/mail.log | tail -20
# Count SMTP errors
sudo grep -i error /var/log/mail.log | wc -l
Method 3: Automated Email Monitoring with Zuzia.app
Manual checks work while you are looking. To keep running them without you, Zuzia uses its agent and scheduled tasks.
How it works in Zuzia
- Install the Zuzia agent on the server with one command. CPU, RAM, disk, load and network metrics start reporting on their own, with alerts on a threshold, on drift from the server's normal, or on a disk fill-up forecast.
- Save the commands from this guide as a scheduled task and choose how often it runs, from every minute to once a year. The agent runs it on every host you pick.
- If a command fails, you get an alert right away by email, Slack, Discord, push (through your Pushover account) or SMS (through your Vonage account).
- The output of every run is kept, so you can look back at what changed. On paid plans, AI can read the output and alert you only when it spots a problem.
Setting it up
- Add the server in the Zuzia dashboard and install the agent.
- Create a scheduled task with the check commands below, then choose the hosts and how often it runs.
- Choose your notification channels. Turn on maintenance mode during planned work so it doesn't trigger alerts.
Best Practices for Email Delivery Monitoring
1. Monitor Email Queue Continuously
- Track email queue size regularly
- Alert when queue exceeds thresholds
- Monitor queue processing rate
- Investigate queue growth patterns
2. Monitor SMTP Server Performance
- Track SMTP server availability
- Monitor SMTP response times
- Check SMTP error rates
- Test SMTP connectivity regularly
3. Track Email Delivery Success
- Monitor delivery success rates
- Track bounce rates
- Review delivery failures
- Optimize email server configuration
4. Set Up Comprehensive Alerts
- Configure alerts for queue size
- Set up alerts for SMTP failures
- Monitor email delivery failures
- Alert on SMTP server unavailability
5. Review Email Logs Regularly
- Review email logs weekly
- Identify error patterns
- Track delivery trends
- Optimize based on log analysis
Troubleshooting Email Delivery Issues
Step 1: Identify Email Problems
When email delivery fails:
Check Email Queue:
- Review queue size
- Check queue age
- Identify stuck emails
Review SMTP Status:
- Test SMTP connectivity
- Check SMTP server logs
- Review SMTP errors
Check Email Logs:
- Review delivery logs
- Identify failure patterns
- Check error messages
Step 2: Resolve Email Issues
Based on investigation:
Fix Queue Issues:
- Process stuck emails
- Clear queue if needed
- Fix queue processing
Fix SMTP Issues:
- Resolve SMTP server problems
- Fix SMTP configuration
- Update SMTP credentials
Optimize Email Delivery:
- Optimize email server configuration
- Improve delivery rates
- Scale email infrastructure if needed
FAQ: Common Questions About Email Delivery Monitoring
How often should I check email queue?
For production email servers, continuous automated monitoring is essential. Zuzia.app can check email queue every few minutes, storing historical data and alerting you when queue size exceeds thresholds.
What is considered a large email queue?
Large email queue depends on your email volume. Generally, queues over 100 emails indicate potential issues, and queues over 500 emails require immediate attention. Set thresholds based on your email volume.
How do I monitor SMTP server performance?
Monitor SMTP server performance by testing SMTP connectivity, checking SMTP response times, monitoring SMTP error rates, and reviewing SMTP server logs. Zuzia.app can help automate this monitoring.
Can email monitoring impact email delivery?
Email monitoring commands have minimal impact on email delivery when done correctly. Use appropriate monitoring frequency and avoid monitoring during peak email sending periods.
Related guides, recipes, and problems
Related guides
guides--server-performance-monitoring-best-practices.mdguides--monitoring-application-performance-linux.md
Related recipes
recipes--monitor-email-queue-smtp-status.mdrecipes--monitor-system-log-entries-linux.md
Related problems
problems--email-delivery-failures-smtp-errors.mdproblems--service-not-running-linux.md