Timeout Errors
Error: operation timed out: tcp connect timeout
Error: operation timed out: tcp connect timeout
Error Code: Cause:
timeoutFull Message:- IMAP server is unreachable
- Network connectivity issues
- Firewall blocking outbound connections
- Incorrect hostname or port
- Server is down
1. Verify Server Details
Check that hostname and port are correct:| Provider | Host | Port |
|---|---|---|
| Gmail | imap.gmail.com | 993 |
| Outlook/Office 365 | outlook.office365.com | 993 |
| Yahoo | imap.mail.yahoo.com | 993 |
| iCloud | imap.mail.me.com | 993 |
| Fastmail | imap.fastmail.com | 993 |
2. Test Connectivity
Verify network access to the IMAP server:3. Increase Timeout
If the server is slow to respond, increase the connection timeout:4. Check Firewall Settings
Ensure your firewall allows outbound connections on port 993:- Corporate networks may block IMAP ports
- VPN or proxy settings may interfere
- Check network security policies
5. Verify Server Status
Check if the email provider is experiencing issues:- Gmail: https://www.google.com/appsstatus
- Office 365: https://status.office.com/
- Check provider’s status page
Error: operation timed out: TLS handshake timeout
Error: operation timed out: TLS handshake timeout
Error Code: Cause:The server uses system root certificates (webpki-roots) and requires TLS 1.2+.
timeoutFull Message:- TLS negotiation taking too long
- Incompatible TLS versions
- Network latency
- Server overload
1. Increase Greeting Timeout
The TLS handshake uses the greeting timeout setting:2. Check Network Quality
- High latency or packet loss can cause TLS timeouts
- Test with ping:
ping imap.gmail.com - Check for network congestion
3. Verify TLS Support
Ensure the server supports modern TLS:Error: operation timed out: IMAP greeting timeout
Error: operation timed out: IMAP greeting timeout
Error: operation timed out: IMAP login timeout
Error: operation timed out: IMAP login timeout
Error Code: Cause:
timeoutFull Message:- Authentication taking too long
- Server processing delay
- Large account with slow mailbox indexing
Increase Greeting Timeout
Login uses the greeting timeout setting:Notes
- First login after password change may be slower
- Large mailboxes may take longer to authenticate
- Some servers perform indexing during login
Error: operation timed out: UID FETCH timed out
Error: operation timed out: UID FETCH timed out
Error Code: Cause:
timeoutFull Message:- Large message taking too long to download
- Slow server response
- Network bandwidth limitations
Increase Socket Timeout
For Large Messages
- Use
imap_get_message_rawwith appropriatemax_byteslimit - Large attachments may require longer timeouts
- Consider connection quality and bandwidth
Error: operation timed out: UID SEARCH timed out
Error: operation timed out: UID SEARCH timed out
Error Code: Cause:
timeoutFull Message:- Very large mailbox
- Complex search query
- Server performing full-text search
- Slow server
1. Increase Socket Timeout
2. Narrow Search Query
Use more specific filters to reduce search time:3. Search Smaller Mailboxes
If searching “All Mail” or large archive folders, try searching specific folders instead.Error: operation timed out: NOOP timed out
Error: operation timed out: NOOP timed out
Network Errors
Error: internal error: tcp connect failed: Connection refused
Error: internal error: tcp connect failed: Connection refused
Error Code: Cause:
internalFull Message:- Server is not listening on the specified port
- Wrong port number
- Server is down
- Firewall blocking connection
1. Verify Port Number
Standard IMAP ports:- 993 - IMAP over TLS (default)
143- Plain IMAP (not supported by this server)
2. Check Server Status
- Verify the mail server is running
- Check provider status pages
- Test with another IMAP client
3. Test Connection
Error: internal error: TLS handshake failed: ...
Error: internal error: TLS handshake failed: ...
Error Code: Cause:
internalFull Message:- Invalid server certificate
- Expired certificate
- Self-signed certificate (not trusted)
- Certificate name mismatch
- System root certificates out of date
1. Verify Server Certificate
2. Update System Certificates
The server uses webpki-roots for certificate validation:- Update your system’s root certificates
- On Linux:
sudo update-ca-certificates - On macOS: Certificates update with system updates
3. Check Certificate Validity
- Expired certificates: Contact mail provider
- Self-signed certificates: Not supported (use a valid certificate)
- Name mismatch: Ensure hostname matches certificate
Note
This server enforces strict TLS certificate validation for security. Self-signed certificates are not accepted.Error: internal error: IMAP server closed connection before greeting
Error: internal error: IMAP server closed connection before greeting
Error Code: Cause:
internalFull Message:- Server rejected connection immediately
- Too many concurrent connections
- IP address blocked or rate-limited
- Server maintenance
1. Check Connection Limits
- Gmail: Max 15 concurrent connections per account
- Most servers: 3-10 concurrent connections
- Wait a few minutes and retry
2. Verify IP Not Blocked
- Check if your IP is rate-limited
- Try from a different network
- Contact email provider if blocked
3. Check Server Status
- Server may be in maintenance mode
- Check provider status page
Timeout Configuration
Available Timeout Settings
All timeout values are in milliseconds:Recommended Settings by Scenario
Fast, reliable network:Diagnostic Commands
Test Network Connectivity
Test TLS Connection
Test IMAP Protocol
Related Documentation
- Authentication Issues - Login and credential errors
- Common Errors - Other frequent errors
- Advanced Configuration - Timeout and performance tuning