# Use PowerMail from the terminal with the pm command

> Read, search and file mail, check your calendar and sync your accounts from PowerShell or Windows Terminal, with the pm command that comes with PowerMail.

## Goal

Work with your mail and calendar from a terminal: read and search first, and allow changes only when you want them.

## Before you start

- PowerMail installed, with at least one account signed in.
- A terminal on the same PC, such as Windows Terminal or PowerShell.

## Steps

1. **Run pm** Open a terminal and type pm. It comes with PowerMail and works with the same mailbox as the app. pm shows its topics: mail, calendar, accounts, ai, agents and tools. pm help mail lists one topic's commands with examples; pm help --all lists every command at once.
   ![Windows Terminal after pm: the PowerMail banner and the six help topics, each with its pm help command.](https://raiken.io/assets/kb/powermail/powermail-terminal-pm/pm-start.png)
2. **Read your inbox** pm inbox shows your unified inbox, newest first and numbered; add --limit 10 for fewer rows. pm read 3 shows the third mail as text, with each link's destination, and doesn't mark it read. pm browse opens the inbox on its own screen: the arrow keys or the mouse wheel move, Enter or a click opens a mail, and q quits.
3. **Search** pm search invoice acme searches your local index for plain words and shows up to 50 hits. Add --servers to ask your mail servers too; what they find is added to the index.
4. **Check your calendar** pm calendar lists the next seven days, day by day. --from and --to set the days, like pm calendar --from 2026-11-02 --to 2026-11-06. pm calendar asks shows the mail that asks for something by a day. pm planner is the same command.
5. **Sync and check your accounts** pm status shows how many messages are stored, the changes waiting to sync, and whether the terminal is read-only. pm sync syncs every account, or one by its address, like pm sync work@example.com, and sends the waiting changes. pm accounts lists your signed-in accounts.
6. **Allow changes from the terminal** pm starts read-only: it can read and search but not change your mail or events. To file mail or change events from the terminal, open Settings > Apps & agents (MCP) > Safety & approvals in PowerMail and turn off Keep the terminal read-only. Turn it back on when you're done.
7. **File mail** pm inbox --ids adds each mail's id. Then use the id, never the row number: pm archive <id>, pm mark-read <id>, pm mark-unread <id>, pm junk <id>, or pm delete <id>, which moves the mail to Deleted Items, where you can still restore it. pm folders lists an account's folder ids for pm move <id> <folder-id>. Each change waits for the next sync; run pm sync to send it now.
   ![pm help mail: the commands to read mail, file it by id and list or delete folders, with examples.](https://raiken.io/assets/kb/powermail/powermail-terminal-pm/pm-help-mail.png)
8. **Plan events** pm calendar add "Write report" 2026-11-03T09:00 2026-11-03T11:00 --account <account> blocks time on that account's calendar, with nobody invited; add --todo to make it a todo. pm calendar --ids shows the account and event id that edit and delete take. pm calendar edit <account> <event-id> --start 2026-11-03T10:00 moves an event, and pm calendar help lists every change. pm calendar delete <account> <event-id> shows what it would delete; add --yes to delete it.

## Tips

- Topic words work in front of a command: pm mail read 3 runs pm read 3.
- pm calendar delete and pm folders delete only act with --yes. Without it, pm calendar delete shows what it would delete.
- Add a Microsoft account from the terminal with pm accounts add; IMAP accounts, such as Gmail and iCloud, are added in the app.

## Result

You read, search and plan from the terminal, and the changes you allow reach your mail servers and calendars on the next sync.

## If something goes wrong

- **The terminal says pm is not recognized.** -> Check that PowerMail is installed, then open Windows Settings > Apps > Advanced app settings > App execution aliases and turn on PowerMail's pm.exe. Open a new terminal window and try again.
- **A command stops with: blocked - the terminal is read-only.** -> Keep the terminal read-only is on. Turn it off in PowerMail under Settings > Apps & agents (MCP) > Safety & approvals, then run the command again.
- **pm read 3 shows a different mail than you expected.** -> The numbers follow the inbox as it is now, so new mail shifts them. Run pm inbox --ids and read the mail by its id.
- **A filed mail is still in the inbox on your other devices.** -> Changes wait for the next sync. Run pm sync; pm status shows the changes still waiting.
- **After you closed pm browse, the mouse types codes into the terminal.** -> Run pm browse again and press q to quit it properly.

## Common questions

### Can pm change anything while Keep the terminal read-only is on?

No mail, folders or events. It can still sync, sign in a new Microsoft account in your browser, and clear the local caches with pm cache clear.

### Should an AI agent use pm?

Pair it with PowerMail instead, under Settings > Apps & agents (MCP). It then works through pm mcp serve, with the permissions you chose and your OK for changes. pm mcp list shows the paired agents and pm mcp revoke removes one.

### Can I see what was changed from the terminal?

Yes. pm audit lists the mail archived, deleted, moved or marked as junk from the terminal, deleted folders, account sign-ins, policy changes and calendar changes. Add --limit 20 for the latest 20.

### Can pm delete a whole folder?

Only with pm folders delete <account> <folder-id> --yes, and never a standard folder such as Inbox or Sent. It deletes the folder with its mail and subfolders, so check the folder id with pm folders first.

## Related guides

- [Connect an AI app or agent to PowerMail over MCP](https://raiken.io/kb/powermail/powermail-apps-and-agents): Pair Claude, Cursor, VS Code, Hermes Agent or any other MCP client with PowerMail, choose what it may do, and see what it did.
- [Find any mail with search, and catch up with the daily digest](https://raiken.io/kb/powermail/powermail-search-and-digest): Search mail, events, todos and settings from one box with Ctrl+F, narrow the results and act on them. Show the daily digest when you want one view of what needs doing and what can go.
- [Plan your day: calendar, todos and the focus timer](https://raiken.io/kb/powermail/powermail-planner-calendar-todos): See your calendar and todos side by side in the Planner, drag todos onto free time, and track the time you spend with the focus timer.

---

Source: https://raiken.io/kb/powermail/powermail-terminal-pm (PowerMail help centre). Reviewed: 2026-10-31.
