# IMAP: NO [ALERT] Too many simultaneous connections. (Failure)

**Code:** `IMAP: Too many simultaneous connections` · **Category:** Email / SMTP · **Seen on:** SMTP, Python

The server limits concurrent IMAP sessions per account and your clients (phone, laptop, scripts) opened more than allowed.

## Meaning

Gmail allows about 15 simultaneous IMAP connections; hosts often allow far fewer. Scripts that connect without logging out, or clients that reconnect rapidly, leak sessions until the limit is hit. Close connections properly, reuse one session, and reduce the number of devices polling the mailbox.

## Common causes

- Script not calling `logout()` so sessions stay open until timeout
- Many devices/clients on one mailbox
- Reconnect loop after errors
- IMAP IDLE sessions never closed
- Low per-IP limit on shared hosting

## Quick fix

1. Always `logout()` in a `finally` block
2. Reuse one connection for several operations
3. Wait a few minutes for old sessions to time out and reduce clients

## Detailed fix by platform

### Python

1. `try: ... finally: m.close(); m.logout()` with `imaplib.IMAP4_SSL`

## How to diagnose

1. **Clients** — How many devices/scripts?
2. **Cleanup** — logout called?
3. **Limit** — Provider's cap?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/email/imap-too-many-simultaneous-connections)
