Content
# NetEase Mail Codex Plugin
NetEase Mail Codex Plugin is a local Codex plugin that connects to NetEase email accounts using IMAP and SMTP, including `163.com`, `126.com`, and `yeah.net`.
It does not automate the NetEase email master desktop client, but works through standard email protocols: IMAP for reading and searching emails, and SMTP for sending emails.
## Features
- Checks NetEase email configuration status without exposing the authorization code.
- Lists IMAP mailbox folders.
- Searches recent emails, supporting filtering by sender, subject, and text keywords.
- Reads the body, sender, recipient, date, and attachment summary of a single email.
- Prepares email drafts but does not save them to the mailbox.
- Sends emails via SMTP, disabled by default and requires explicit enablement.
The current version does not delete emails, move emails, mark as read, or modify mailbox status.
## Directory Structure
```text
.
├── .agents/
│ └── plugins/
│ └── marketplace.json
├── plugins/
│ └── netease-mail/
│ ├── .codex-plugin/
│ │ └── plugin.json
│ ├── .mcp.json
│ ├── scripts/
│ │ └── netease_mail_mcp.py
│ └── skills/
│ └── netease-mail/
│ └── SKILL.md
├── .gitignore
└── README.md
```
Key file descriptions:
- `plugins/netease-mail/.codex-plugin/plugin.json`: Codex plugin manifest.
- `plugins/netease-mail/.mcp.json`: MCP server startup configuration.
- `plugins/netease-mail/scripts/netease_mail_mcp.py`: IMAP/SMTP plugin implementation.
- `plugins/netease-mail/skills/netease-mail/SKILL.md`: Usage instructions for Codex.
- `.agents/plugins/marketplace.json`: Entry point for this repository as a local marketplace.
## Installation Method 1: From GitHub Repository
Assuming you cloned the repository to:
```text
D:\codex-plugins\netease-mail
```
Add the following to `C:\Users\<your_username>\.codex\config.toml`:
```toml
[marketplaces.netease-mail]
last_updated = "2026-05-26T00:00:00Z"
source_type = "local"
source = '\\?\D:\codex-plugins\netease-mail'
[plugins."netease-mail@netease-mail"]
enabled = true
```
Where:
- `[marketplaces.netease-mail]`'s `netease-mail` is the name you give to this local marketplace.
- `source` points to the repository root directory, which contains `.agents/plugins/marketplace.json`.
- `[plugins."netease-mail@netease-mail"]`'s first part is the plugin name, and the second part is the marketplace name.
After modification, completely exit and restart the Codex desktop client.
## Installation Method 2: Install to Personal Plugin Directory
You can also copy the plugin to your personal plugin directory:
```text
C:\Users\<your_username>\plugins\netease-mail
```
Then add the following to `C:\Users\<your_username>\.agents\plugins\marketplace.json`:
```json
{
"name": "netease-mail",
"source": {
"source": "local",
"path": "./plugins/netease-mail"
},
"policy": {
"installation": "AVAILABLE",
"authentication": "ON_INSTALL"
},
"category": "Productivity"
}
```
And add the following to `C:\Users\<your_username>\.codex\config.toml`:
```toml
[marketplaces.personal]
last_updated = "2026-05-26T00:00:00Z"
source_type = "local"
source = '\\?\C:\Users\<your_username>'
[plugins."netease-mail@personal"]
enabled = true
```
After modification, completely exit and restart the Codex desktop client.
## MCP Path Configuration
The `plugins/netease-mail/.mcp.json` in the repository uses relative paths by default:
```json
{
"mcpServers": {
"netease-mail": {
"command": "python",
"args": [
"./scripts/netease_mail_mcp.py"
]
}
}
}
```
If your Codex version cannot start the MCP server from a relative path, change `args` to the absolute path of the script. For example:
```json
{
"mcpServers": {
"netease-mail": {
"command": "python",
"args": [
"D:\\codex-plugins\\netease-mail\\plugins\\netease-mail\\scripts\\netease_mail_mcp.py"
]
}
}
}
```
In Windows paths, backslashes need to be written as `\\` because `.mcp.json` is a JSON file.
## Email Configuration
The plugin reads email configurations through environment variables. Do not write the authorization code into the GitHub repository.
Required configurations:
```powershell
setx NETEASE_MAIL_ADDRESS "<your-netease-mail-address>"
setx NETEASE_MAIL_AUTH_CODE "your-client-authorization-code"
```
`NETEASE_MAIL_AUTH_CODE` should use the client authorization code of NetEase email, not the web login password.
Optional configurations:
```powershell
setx NETEASE_MAIL_IMAP_HOST "imap.163.com"
setx NETEASE_MAIL_IMAP_PORT "993"
setx NETEASE_MAIL_SMTP_HOST "smtp.163.com"
setx NETEASE_MAIL_SMTP_PORT "465"
```
Sending emails is disabled by default. Enable it when needed:
```powershell
setx NETEASE_MAIL_ENABLE_SMTP "true"
```
If the SMTP authorization code is different from the IMAP authorization code, configure it separately:
```powershell
setx NETEASE_MAIL_SMTP_PASSWORD "your-smtp-authorization-code"
```
After using `setx`, you need to restart the Codex desktop client or reopen the terminal for the new environment variables to take effect.
## Usage Examples
You can say in Codex:
```text
Check my 163 email configuration status
```
```text
List my 163 email folders
```
```text
Search my recent 7 days' 163 emails
```
```text
Send a greeting email to someone using my 163 email
```
When sending emails, the plugin still requires the tool call to carry `confirm_send: true` to prevent accidental sending.
## Local Verification
You can directly run the MCP's configuration check tool to confirm if the plugin script and environment variables are normal:
```powershell
'{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_config_status","arguments":{}}}' | python .\plugins\netease-mail\scripts\netease_mail_mcp.py
```
If the configuration is normal, you will see fields like:
```json
{
"address_configured": true,
"imap_password_configured": true,
"imap_ready": true,
"smtp_enabled": false
}
```
`smtp_enabled` being `false` only indicates that sending is not enabled, and does not affect reading emails.
## Security Notes
- The plugin does not return or print the email authorization code.
- IMAP reading capability is enabled by default.
- SMTP sending requires `NETEASE_MAIL_ENABLE_SMTP=true`.
- The sending tool also requires explicit confirmation of the parameter `confirm_send: true`.
- The current version does not provide tools for deleting, moving, or marking emails.