> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mail.ugmail.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Download Email to Your Device via POP3 on UGMail (Port 995)

> Connect to UGMail's POP3 server at mail.ugmail.co:995 with SSL/TLS to download messages locally. Best for offline or archival workflows.

POP3 (Post Office Protocol version 3) lets you download email messages from a UGMail mailbox directly to your local machine or application. Unlike IMAP, POP3 does not keep your client and server in continuous sync — it retrieves messages and, by default, removes them from the server. This makes POP3 a good fit for offline processing, local archival pipelines, and scenarios where you want a single application to own the messages rather than multiple clients sharing a live view.

## Connection settings

Configure your POP3 client with the following details:

| Setting  | Value                      |
| -------- | -------------------------- |
| Server   | `mail.ugmail.co`           |
| Port     | `995`                      |
| Security | SSL/TLS                    |
| Username | Your mailbox email address |
| Password | Your mailbox password      |

## Authentication

Use your mailbox's full email address as the username (e.g. `alice@example.com`) and the password you set via the `secrets` field in the Management API as the password.

## POP3 vs. IMAP — which should you use?

Both protocols give you access to incoming messages, but they serve different purposes. Use the table below to choose the right one for your workflow.

|                                        | POP3                                             | IMAP                               |
| -------------------------------------- | ------------------------------------------------ | ---------------------------------- |
| **Messages stored on server**          | Temporarily (deleted after download by default)  | Permanently, until you delete them |
| **Multi-device / multi-client access** | Not recommended                                  | Ideal                              |
| **Offline access after download**      | Yes                                              | Depends on client caching          |
| **Folder sync**                        | No                                               | Yes                                |
| **Best for**                           | Single-destination ingestion, archival pipelines | Interactive use, multiple clients  |

Choose **POP3** when a single process or application should consume messages as a stream and you don't need server-side folder management. Choose **IMAP** when you need to access the same mailbox from multiple clients or keep messages organized in server-side folders.

<Note>Most POP3 clients offer an option to **leave messages on the server** after download. Enable this setting if you want to use POP3 alongside another client without deleting messages prematurely.</Note>

## Code example

Use Python's built-in `poplib` module to connect, list messages, and retrieve them one by one.

```python Python (poplib) theme={null}
import poplib

pop = poplib.POP3_SSL('mail.ugmail.co', 995)
pop.user('alice@example.com')
pop.pass_('SecurePassword123!')

num_messages = len(pop.list()[1])
for i in range(num_messages):
    _, lines, _ = pop.retr(i + 1)
    print(b'\n'.join(lines).decode())

pop.quit()
```

`pop.list()` returns a summary of all messages in the mailbox. `pop.retr(n)` downloads the full RFC 822 message at index `n` (1-based). Call `pop.dele(n)` before `pop.quit()` if you want to delete a specific message from the server after processing it.

## Troubleshooting

<Warning>POP3 deletes messages from the server after download unless you explicitly configure your client to retain them. If messages disappear from other clients after a POP3 session, check whether your POP3 client has "delete on server after retrieval" enabled and disable it if needed.</Warning>

| Symptom                               | Likely cause                              | Fix                                                                                         |
| ------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------- |
| `Connection refused` on port 995      | Firewall blocking outbound port 995       | Open outbound port 995, or check with your network administrator                            |
| `Authentication failed`               | Incorrect username or password            | Confirm the username is the full email address and the password matches the `secrets` field |
| Messages disappear from other clients | POP3 client deleting messages on download | Enable "leave messages on server" in your POP3 client settings                              |
| Only new messages downloaded          | Client tracking last-seen message ID      | Reset the client's "last downloaded" pointer or connect with a fresh client instance        |
