=== Webmail for WordPress ===
Contributors: jrdevelopr
Tags: webmail, email, imap, smtp, mail
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.2.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Your mailbox inside wp-admin. Three panes, any IMAP provider, nothing stored.

== Description ==

Webmail for WordPress puts a real mail client in your dashboard — folders on
the left, messages in the middle, the one you are reading on the right, drawn
with WordPress's own colours, spacing and type so it reads as part of the admin
rather than a guest in it.

It is not an embedded third-party app in an iframe. It is an admin screen that
speaks IMAP.

**Nothing is stored.** Every message is read live from your mail server for
that request. There are no custom database tables, no cron jobs, and no copy of
your mail on the website. Your provider is still the real mailbox: read a
message here and it is read there; delete one here and it is in that account's
bin, where you can get it back.

= What it does =

* **Any IMAP provider.** Presets for Gmail / Google Workspace, Outlook /
  Microsoft 365, Yahoo, iCloud, Fastmail and Zoho — or enter your own servers.
  Picking a preset fills the boxes in and leaves them editable.
* **Send** over that same mailbox's SMTP, with a signature you set once.
* **Search** a folder, answered by the mail server. Uses Gmail's own index
  where it is available.
* **Row actions on hover** — star, and Delete · Archive · Reply.
* **Multi-select** with shift and ctrl/cmd, then act on the lot.
* **Undo.** Archived or deleted something by accident? The offer stands until
  you do something else — no countdown, because "oops" arrives at its own
  speed.
* **Remote images are held back** until you say so, because loading one tells
  the sender you opened the message. Trust a sender once and theirs load from
  then on.
* **Works on a phone.** The icon rail stays on screen, the message fits the
  screen, and every dialog has a way out.

= Who can use it =

Two capabilities, both filterable:

* `publish_posts` — read and send mail
* `edit_others_posts` — change the mailbox settings

Reading the mail is an everyday job; the mailbox password is not.

= POP is not supported =

Deliberately, and it cannot be. POP has no folders, no flags, no server-side
search and no move — and every screen here depends on all four.

= For developers =

Filters: `wmfw_identity` and `wmfw_signoff` (who the mail comes from and how it
signs off), `wmfw_capability` and `wmfw_settings_capability` (who may read mail
and who may change the mailbox), `wmfw_allowed_types` and `wmfw_image_max_side`
(what may be attached and how big pictures are sent), `wmfw_purge_days`, and
`wmfw_log`.

There are also `wmfw_pre_*` seams in front of every mail operation, so a
different store can sit behind the whole screen — which is how the live demo
runs a real copy of it with no mail server at all.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/` and activate it.
2. Go to **Webmail → Settings**, pick your provider, enter the mailbox address
   and password, and turn the switch on.
3. **Webmail** appears in the sidebar. It does not appear before that, on
   purpose — a menu item whose only message is "nothing is connected" is worse
   than none.

Most providers need an **app password** rather than your account password when
two-step verification is on.

== Frequently Asked Questions ==

= Does it work with something other than Gmail? =

Yes. Host, port, encryption and the SMTP triplet are all settings. The presets
are a convenience, not a limit.

= Is my mail copied onto the website? =

No. Nothing is stored. The only things saved are your mailbox settings and the
list of senders whose images you chose to trust — both removed when you
uninstall.

= Where is the password kept? =

In a WordPress option on your own site, never in code. The settings field shows
a mask rather than the value, and re-saving the form does not overwrite what is
stored unless you actually type something new.

= Can I use it on a phone? =

Yes — it is built for 320px up.

== Screenshots ==

1. The mailbox: folders on the left, the list in the middle, and the message you are reading on the right — drawn with WordPress's own colours, spacing and type.
2. Composing a reply, with autocomplete over your saved contacts.
3. Contacts, kept in their own SQLite file rather than in the WordPress database.
4. Attachments preview inside the reading pane instead of forcing a download.
5. Settings, with app-password steps for your provider folded under the password box.
6. Tablet, landscape.
7. Phone: the message list.
8. Phone: reading a message.

== Changelog ==

= 0.2.3 =

Fixed:

* 0.2.2 could not read mail at all — update if you installed it. The change that stopped this plugin colliding with other plugins' copies of its shared libraries mangled five type declarations while it did so, two of them inside the IMAP library itself. The result was a fatal error the moment a message date was parsed, which is to say immediately. 0.2.2 was withdrawn; this release fixes it and keeps the collision protection.

Nothing yet.

= 0.2.2 =

Fixed:

* **This plugin can no longer argue with another one about which library the site gets.** The IMAP library brings Carbon, Illuminate and Symfony with it. Shipped under their own names, whichever plugin's autoloader registered first decided the version everybody got — and the loser crashed on a method that did not exist in the version that won. The whole dependency tree is now rewritten under this plugin's own namespace before it ships, so it simply cannot take part in that argument. Nothing changes that you can see; it is the class of bug where the only symptom is another plugin breaking.

Nothing yet.

= 0.2.1 =

Added:

* This is a beta release, and says so. A Beta badge appears on the mailbox, the contacts screen, the settings card and the plugins list, so nobody runs a pre-release build without being told. One constant in the bootstrap turns it all off on release.
* Contacts. A proper address book, with everything an address book needs: add a sender straight from the message you are reading, a list you can search and sort, a card you can edit, suggestions as you type a recipient, and CSV import and export. Reading a message from somebody you already have shows a quiet link to their card instead of offering to add them again.
* Contacts are kept in a SQLite file of their own, under wp-content/webmail-for-wordpress/, with a plain-English README.txt beside it explaining what the file is and how to open it without the plugin. Nothing is added to your site's database.
* Uninstalling keeps your contacts unless you tick the box that says otherwise, and WordPress offers you a CSV first — but only when you actually have contacts to lose.
* Pull requests welcome: CONTRIBUTING.md, SECURITY.md, issue and PR templates, and CI that runs the whole suite on PHP 8.1 and 8.3.
* A form on the website for reporting a problem without a GitHub account.
* A theme or framework can embed this plugin. The path constants are guarded rather than assigned, so something that vendored this code can say where it actually lives — otherwise every stylesheet and icon 404s while the PHP runs perfectly. It also boots when loaded after plugins_loaded has already fired, which is what happens from a theme. A copy loaded that way leaves the updater and the uninstall offer alone, because neither has any business touching a directory somebody else manages.
* A site can supply its own contacts. Three filters — wmfw_contact_card, wmfw_contacts_for_compose and wmfw_contacts_available — let a site that already knows who its correspondents are answer from its own records, instead of running a second address book that disagrees with the first. Adding no filters changes nothing at all.
* The address book is now optional. One box on the settings screen. Unticking it hides the feature and deletes nothing — your contacts stay in their file and come back whole if you tick it again.

Changed:

* The website says "Up and running in three steps" rather than "three steps, one card" — "card" was our word for it, not yours.

Fixed:

* "Visit plugin site" now goes to the website, not to the source repository. Somebody clicking that link wants to know what the plugin is, not to read its commit history.
* The plugin now actually runs on PHP 8.1, which its header has always claimed. The bundled dependencies had quietly acquired versions needing PHP 8.3, so a site on 8.1 would have installed it and broken. Composer is now pinned to resolve against the version the header promises. A happy side effect: the dependency tree went from 26 packages to 16, and the download from 2.4 MB to 2.1 MB.
* A file was missing from the published download. includes/secret-field.php — the masked password field — was excluded by a stray ignore rule, so a fresh install fataled on activation. Anyone who downloaded between the repository rebuild and this release should update.
* No more Contacts menu leading nowhere. On a server without the SQLite extension, the sidebar offered Contacts anyway and the screen then declined to open. The menu now appears only when there is an address book to show. The settings screen also stops blaming your server for a book you switched off yourself, which would have sent you to your host with a question they could not answer.

= 0.2.0 =

Added:

* Updates straight from GitHub. Dashboard → Updates now offers new versions of this plugin the same way it offers any other, with no wordpress.org listing involved. There is also a Check for updates link on the plugins screen for when you would rather not wait for the twice-daily check.
* The stored password can be revealed. The eye beside the password field used to disappear once a password was saved, so you could replace it but never check it. It now fetches the stored value when you ask — nonce- and capability-checked, rather than printing a live mailbox password into the page source of every settings load.
* App-password instructions on the settings card. Each provider carries its own steps, folded away under the password box, changing with the dropdown, and linking to that provider's own page. No pop-ups.
* A nightly tidy-up. Trash and Spam are emptied of anything older than thirty days, on your mail server. The inbox is never touched.

Changed:

* The IMAP and SMTP boxes stop at the same width as the fields above them instead of running the full width of the card.

Removed:

* The contact-record contract. "Is this sender someone we already know?" shipped as three filters with no implementation behind them, plus a filing dialog and a chip beside the sender's name. A general-purpose mail client has no business assuming the site keeps customer records, so all of it came out. Trusted senders — whose remote pictures load without asking — is about mail rather than records, and stayed.

Security:

* The repository was rebuilt from scratch with a single commit. A live Gmail app password had been used as a test fixture early in development, and while it left the working tree the same day, it remained in the history behind it. Removing a secret from a checkout does not remove it from the commits, so the history went instead.

= 0.1.0 =

First release, ported from a working module in a private theme.

* Three-pane mail client inside wp-admin: folders, list, reading pane.
* Any IMAP provider, with presets for Gmail, Outlook, Yahoo, iCloud, Fastmail and Zoho. No ext/imap required — the IMAP client is pure PHP.
* Sends over the mailbox's own SMTP rather than wp_mail(), so replies thread properly and sent mail lands in that account's Sent folder.
* Nothing is stored: every message is read live from the mail server.
* Undo that waits — archive, trash and move stay reversible until you do something else, and undo puts the message back where it was.
* Remote images held back until you trust the sender.
* Attachments preview in the reading pane; outgoing files are allow-listed, type-checked and shrunk when enormous.
* Works down to a 320px screen.

== Upgrade Notice ==

= 0.2.0 =
Adds contacts, in-dashboard updates, and app-password instructions per provider. Your settings and stored password carry over untouched.
