|
1 | 1 | # Bulwark JMAP Mail |
2 | 2 |
|
3 | | -A WordPress plugin that replaces the default PHP mail function with the modern [JMAP protocol](https://jmap.io/) (RFC 8620/8621) for sending emails. |
| 3 | +A WordPress plugin that routes `wp_mail()` through the modern [JMAP protocol](https://jmap.io/) (`RFC 8620` / `RFC 8621`) instead of relying on PHP mail or a traditional SMTP plugin. |
| 4 | + |
| 5 | +Source repository: [bulwarkmail/wordpress-jmap](https://github.com/bulwarkmail/wordpress-jmap) |
4 | 6 |
|
5 | 7 | ## Features |
6 | 8 |
|
7 | | -- Sends all WordPress emails via your JMAP server |
8 | | -- Automatic JMAP session discovery via `.well-known/jmap` |
9 | | -- HTML and plain text email support with automatic plain-text fallback |
10 | | -- File attachment support via JMAP blob upload |
11 | | -- CC, BCC, and Reply-To header support |
12 | | -- Identity auto-detection from JMAP server |
13 | | -- Separate test recipient for admin test emails |
14 | | -- Built-in mail log for sent and failed delivery attempts |
15 | | -- Connection test and test email from the admin panel |
16 | | -- Compatible with any RFC 8620/8621 compliant JMAP server (Stalwart, Cyrus, etc.) |
| 9 | +- Sends WordPress mail through any compatible JMAP server |
| 10 | +- Discovers the JMAP session automatically via `.well-known/jmap` |
| 11 | +- Handles redirected discovery endpoints and normalizes advertised API URLs for reverse-proxy setups |
| 12 | +- Resolves the sender identity and Sent mailbox automatically |
| 13 | +- Supports HTML and plain-text messages with plain-text fallback |
| 14 | +- Supports CC, BCC, Reply-To, and file attachments |
| 15 | +- Provides a dedicated **Test Recipient** field for admin test emails |
| 16 | +- Shows account, identity, capabilities, and warnings in the connection test UI |
| 17 | +- Includes a built-in mail log for recent sent and failed attempts |
| 18 | +- Compatible with RFC 8620/8621 servers such as [Stalwart Mail Server](https://stalw.art/) |
| 19 | + |
| 20 | +## Requirements |
| 21 | + |
| 22 | +- WordPress 5.8 or later |
| 23 | +- PHP 7.4 or later |
| 24 | +- A JMAP server that supports `urn:ietf:params:jmap:core`, `urn:ietf:params:jmap:mail`, and `urn:ietf:params:jmap:submission` |
| 25 | +- An account with at least one usable sending identity |
| 26 | +- Access to a mailbox with the `sent` role |
| 27 | + |
| 28 | +## Installation |
| 29 | + |
| 30 | +1. Download the plugin folder or a release zip. |
| 31 | +2. Upload the zip through **Plugins → Add New → Upload Plugin**, or copy the `bulwark-jmap-mail` folder to `/wp-content/plugins/`. |
| 32 | +3. Activate the plugin. |
| 33 | +4. Open **Settings → JMAP Mail**. |
| 34 | + |
| 35 | +## Configuration |
| 36 | + |
| 37 | +1. Enter your JMAP server URL, username, and password. |
| 38 | +2. Set **From Name** and **From Email**. |
| 39 | +3. Optionally set **Test Recipient** for the **Send Test Email** button. |
| 40 | +4. Enable the plugin and save. |
| 41 | +5. Run **Test JMAP Connection**. |
| 42 | +6. Run **Send Test Email**. |
17 | 43 |
|
18 | 44 | ## How It Works |
19 | 45 |
|
20 | | -1. Hooks into the WordPress `pre_wp_mail` filter to intercept outgoing email |
21 | | -2. Discovers the JMAP session at `{server}/.well-known/jmap` |
22 | | -3. Resolves the sender's identity and the Sent mailbox from the server |
23 | | -4. Creates the email via `Email/set`, then submits it via `EmailSubmission/set` using the returned email id |
| 46 | +1. Hooks into the WordPress `pre_wp_mail` filter to intercept outgoing mail. |
| 47 | +2. Discovers the JMAP session from `{server}/.well-known/jmap`. |
| 48 | +3. Normalizes the advertised JMAP API and upload URLs to the configured public origin when needed. |
| 49 | +4. Resolves the mail account, sender identity, and Sent mailbox. |
| 50 | +5. Creates the message via `Email/set`. |
| 51 | +6. Submits the created message via `EmailSubmission/set` using the returned email id. |
| 52 | +7. Records the result in the admin mail log. |
24 | 53 |
|
25 | | -## Requirements |
| 54 | +## Admin Tools |
26 | 55 |
|
27 | | -- A JMAP-compatible mail server with `urn:ietf:params:jmap:submission` capability |
28 | | -- PHP 7.4 or later |
29 | | -- WordPress 5.8 or later |
| 56 | +- **Test JMAP Connection** validates session discovery and shows the resolved account, identity, capabilities, and warnings. |
| 57 | +- **Send Test Email** sends to **Test Recipient**, then falls back to **From Email**, then the WordPress admin email. |
| 58 | +- **Mail Log** stores the most recent 100 send attempts with timestamps, recipients, subjects, status, and error details. |
| 59 | +- **Clear Mail Log** removes all stored log entries from the plugin settings page. |
30 | 60 |
|
31 | | -Tested with [Stalwart Mail Server](https://stalw.art/). Should work with Cyrus IMAP and other RFC 8620/8621 compliant servers. |
| 61 | +## Mail Log |
32 | 62 |
|
33 | | -## Installation |
| 63 | +The mail log stores metadata only. It does not store message bodies or attachment contents. |
34 | 64 |
|
35 | | -1. Upload the `bulwark-jmap-mail` folder to `/wp-content/plugins/` |
36 | | -2. Activate the plugin through the **Plugins** menu in WordPress |
37 | | -3. Go to **Settings → JMAP Mail** |
38 | | -4. Enter your JMAP server URL, username, and password |
39 | | -5. Enable the plugin and save |
40 | | -6. Optionally set a dedicated **Test Recipient** address for admin test emails |
41 | | -7. Use the **Test Connection** button to verify your setup, then **Send Test Email** to confirm delivery |
| 65 | +Each entry can include: |
| 66 | + |
| 67 | +- Timestamp |
| 68 | +- Status (`sent` or `failed`) |
| 69 | +- Recipient |
| 70 | +- From address |
| 71 | +- Subject |
| 72 | +- Attachment count |
| 73 | +- Account id |
| 74 | +- Identity id |
| 75 | +- Created email id |
| 76 | +- Failure message, if any |
42 | 77 |
|
43 | 78 | ## FAQ |
44 | 79 |
|
45 | 80 | **What is JMAP?** |
46 | | -JMAP (JSON Meta Application Protocol) is a modern open standard for email access and submission defined in RFC 8620 and RFC 8621. It replaces IMAP and SMTP with a single JSON-over-HTTP protocol. |
| 81 | +JMAP (JSON Meta Application Protocol) is a modern open standard for email access and submission defined in RFC 8620 and RFC 8621. It replaces IMAP and SMTP with a JSON-over-HTTP protocol. |
47 | 82 |
|
48 | 83 | **Does this replace SMTP plugins?** |
49 | | -Yes. Instead of configuring SMTP credentials, you configure your JMAP server and all WordPress emails are sent through JMAP's `EmailSubmission` mechanism. |
| 84 | +Yes. Instead of configuring SMTP credentials, you configure your JMAP server and WordPress mail is submitted through JMAP. |
| 85 | + |
| 86 | +**Where does the test email go?** |
| 87 | +The **Send Test Email** button sends to **Test Recipient** if it is set. If that field is empty, it falls back to **From Email**, then the WordPress admin email. |
| 88 | + |
| 89 | +**Why can the connection test succeed while sending still fails?** |
| 90 | +Connection testing only proves that session discovery and basic account access work. Actual sending can still fail if the selected account has no valid sending identity, no accessible Sent mailbox, or if the server rejects submission details. |
50 | 91 |
|
51 | 92 | **Is my password stored securely?** |
52 | | -The password is stored in the WordPress options table. For additional security, consider defining credentials via `wp-config.php` constants or a secrets manager. |
| 93 | +The password is stored in the WordPress options table. For higher-security deployments, consider moving credentials into `wp-config.php` constants or another secret-management layer. |
| 94 | + |
| 95 | +## Packaging |
53 | 96 |
|
54 | | -**What does the mail log store?** |
55 | | -The admin mail log stores the time, recipient, subject, status, and error details for recent send attempts. It does not store email bodies. |
| 97 | +- Generated release archives can be stored in the `releases/` directory. |
| 98 | +- The repository includes a `.gitignore` rule so generated zip files in `releases/` are not committed accidentally. |
56 | 99 |
|
57 | 100 | ## Changelog |
58 | 101 |
|
59 | 102 | ### 1.0.0 |
60 | 103 |
|
61 | | -- Initial release |
| 104 | +- Initial release of the WordPress JMAP mailer |
62 | 105 | - JMAP session discovery and authentication |
63 | | -- Email sending via `Email/set` + `EmailSubmission/set` |
64 | | -- Attachment support via blob upload |
65 | | -- Admin settings page with connection tester |
66 | | -- HTML and plain text email support |
| 106 | +- Compatibility fixes for redirected discovery endpoints and strict JMAP servers |
| 107 | +- Email creation via `Email/set` followed by submission via `EmailSubmission/set` |
| 108 | +- HTML/plain-text messages, CC/BCC/Reply-To, and attachment support |
| 109 | +- Admin connection diagnostics, identity display, and dedicated test recipient |
| 110 | +- Built-in mail log for sent and failed messages |
67 | 111 |
|
68 | 112 | ## License |
69 | 113 |
|
|
0 commit comments