SMTP (Simple Mail Transfer Protocol) issues can disrupt email communication and harm business operations. This guide helps you diagnose and fix common SMTP problems quickly and effectively.
Common SMTP Error Codes
Understanding SMTP error codes is the first step to diagnosing email delivery problems:
- 421 Service not available - Server temporarily unavailable
- 450 Mailbox unavailable - Temporary failure, try again later
- 451 Local error - Server encountered an error processing request
- 452 Insufficient storage - Server out of storage space
- 500 Syntax error - Command not recognized
- 501 Syntax error in parameters - Invalid command parameters
- 502 Command not implemented - Server doesn't support command
- 503 Bad sequence - Commands sent in wrong order
- 504 Parameter not implemented - Command parameter not supported
- 550 Mailbox unavailable - Permanent failure, mailbox doesn't exist
- 551 User not local - Recipient not on this server
- 552 Storage allocation exceeded - Message too large
- 553 Mailbox name invalid - Invalid recipient address
- 554 Transaction failed - General permanent failure
Connection Issues
Cannot Connect to SMTP Server
When you can't establish a connection to the SMTP server:
- Verify server hostname and port (25, 587, 465, 2525)
- Check firewall rules blocking SMTP ports
- Test connectivity with telnet or netcat
- Verify DNS resolution of server hostname
- Check if ISP blocks SMTP ports (common for port 25)
# Test SMTP connectivity
telnet smtp.example.com 587
# Alternative with netcat
nc -v smtp.example.com 587
# Test with openssl for TLS
openssl s_client -connect smtp.example.com:587 -starttls smtpTimeout Errors
Connection timeouts can indicate network or server issues:
- Increase connection timeout settings in your email client
- Check network latency and packet loss
- Verify server is not overloaded or rate limiting
- Try connecting from different network location
- Contact hosting provider about server performance
Authentication Problems
Authentication Failed (Error 535)
Authentication failures are common SMTP issues:
- Double-check username and password credentials
- Verify account is enabled and not locked
- Check if two-factor authentication is required
- Ensure using correct authentication method (LOGIN, PLAIN, CRAM-MD5)
- Test with different email client or webmail
- Check for special characters in password requiring encoding
# Test SMTP authentication manually
# Connect to server
telnet smtp.example.com 587
# Send commands
EHLO yourdomain.com
STARTTLS
# After TLS negotiation
AUTH LOGIN
# Enter base64 encoded username
# Enter base64 encoded passwordOAuth Authentication Issues
Modern providers like Gmail and Outlook require OAuth:
- Enable "Less secure app access" for basic auth (deprecated)
- Configure OAuth 2.0 for modern authentication
- Generate app-specific passwords where available
- Update email client to support OAuth
- Check API permissions and scopes
TLS/SSL Issues
Certificate Problems
SSL/TLS certificate issues can prevent secure connections:
- Verify certificate is valid and not expired
- Check certificate matches server hostname
- Ensure certificate chain is complete
- Update email client certificate store
- Test with different TLS versions (1.2, 1.3)
# Check SSL certificate
openssl s_client -connect smtp.example.com:465
# Check certificate expiration
echo | openssl s_client -connect smtp.example.com:465 2>/dev/null | openssl x509 -dates -noout
# Test STARTTLS
openssl s_client -connect smtp.example.com:587 -starttls smtpDelivery Failures
Messages Not Delivered
When emails are accepted but not delivered:
- Check spam/junk folders of recipients
- Verify sender reputation and blacklist status
- Review SPF, DKIM, and DMARC authentication
- Check message content for spam triggers
- Monitor bounce messages and delivery reports
- Test with different recipient domains
Bounced Messages
Understanding bounce types and responses:
- Hard bounces (5xx codes): Permanent failures requiring action
- Soft bounces (4xx codes): Temporary issues, will retry
- Block bounces: Recipient server blocking your IP/domain
- Content bounces: Message content triggered spam filters
Server Configuration Issues
DNS Configuration
DNS problems can affect email delivery:
- Verify MX records are correctly configured
- Check A/AAAA records for mail server hostnames
- Set up reverse DNS (PTR) records for sending IPs
- Configure SPF records for sender authentication
- Test DNS propagation across multiple resolvers
# Check MX records
dig MX example.com
# Check A record for mail server
dig A mail.example.com
# Check reverse DNS
dig -x 203.0.113.1
# Check SPF record
dig TXT example.com | grep "v=spf1"Rate Limiting and Throttling
Server-imposed sending limits can cause delays:
- Monitor sending rates and volume limits
- Implement exponential backoff for retries
- Spread sending across multiple IPs if available
- Queue management for large volumes
- Work with hosting provider to adjust limits
Debugging Tools and Commands
Command Line Tools
# Test SMTP with swaks (Swiss Army Knife SMTP)
swaks --to [email protected] --from [email protected] --server smtp.example.com:587 --tls
# Send test email with authentication
swaks --to [email protected] --from [email protected] --auth-user [email protected] --auth-password mypassword --server smtp.mydomain.com:587 --tls
# Test specific TLS version
swaks --to [email protected] --from [email protected] --server smtp.example.com:587 --tls --tls-protocol tlsv1_2Log Analysis
Server logs provide detailed troubleshooting information:
- Mail server logs (/var/log/mail.log, /var/log/maillog)
- Application logs from email sending software
- Firewall logs for blocked connections
- DNS query logs for resolution issues
- Authentication service logs
Provider-Specific Issues
Gmail/Google Workspace
- Enable "Less secure app access" or use OAuth 2.0
- Generate app-specific passwords for applications
- Check Gmail API quotas and limits
- Review security settings and blocked sign-ins
- Monitor Gmail Postmaster Tools for reputation
Microsoft 365/Outlook
- Configure modern authentication (OAuth 2.0)
- Check conditional access policies
- Review Exchange Online Protection settings
- Monitor message trace for delivery paths
- Verify SMTP AUTH is enabled for users
Yahoo Mail
- Generate app passwords for third-party apps
- Check account security settings
- Verify POP/IMAP/SMTP settings are enabled
- Review spam filter settings
- Check for account limitations
Prevention and Monitoring
Proactive measures to prevent SMTP issues:
- Monitor server health and performance metrics
- Set up alerting for failed deliveries
- Regular testing of email functionality
- Keep email software and servers updated
- Maintain sender reputation and authentication
- Document configuration for troubleshooting
Use our SMTP Server Test tool to automatically diagnose common SMTP configuration issues and get specific recommendations for fixes.