@axium/email 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,30 +2,28 @@
2
2
 
3
3
  This is a plugin for sending and receiving email using Axium.
4
4
 
5
- Users get an address based on their username and the configured domain (e.g. `jane@example.com`).
6
- Mail between users on the same server is delivered internally.
7
- External mail is received by the plugin's built-in SMTP listener and sent using a configured relay,
5
+ Users get an address based on their username and the configured domain (e.g. `jane@example.com`),
6
+ derived from the server's `origin`. Mail between users on the same server is delivered internally.
7
+ External mail is received by the plugin's built-in SMTP listener.
8
+
9
+ Outbound delivery is handled by `@axium/server`: mail is sent using a configured relay,
8
10
  or delivered directly to the recipient's mail server if no relay is configured.
9
11
 
10
12
  ## Setup
11
13
 
12
- 1. Generate a DKIM key: `axium email dkim-keygen` (set `outbound.dkim.key_file` first, or pass `--out`).
14
+ 1. Generate a DKIM key: `axium dkim-keygen` (writes to `email.dkim.key_file`, or pass `--out`).
13
15
  2. Create the DNS records printed by `axium email dns` (MX, SPF, DKIM, DMARC).
14
16
  3. Make sure port 25 is reachable from the internet for receiving.
15
- 4. If your host can't send on port 25 directly (most residential and many cloud IPs), configure `outbound.relay`.
17
+ 4. If your host can't send on port 25 directly (most residential and many cloud IPs), configure `email.relay` in the main config.
16
18
 
17
19
  ## Configuration
18
20
 
21
+ Outbound sending is configured in the main Axium config under `email`:
22
+
19
23
  ```jsonc
20
24
  {
21
- // If set, overrides the main config's `origin`
22
- "domain": "example.com",
23
- "inbound": {
25
+ "email": {
24
26
  "enabled": true,
25
- "port": 25,
26
- "max_size": 25000, // in KB
27
- },
28
- "outbound": {
29
27
  // If no host is set, mail is delivered directly to the recipient's MX
30
28
  "relay": { "host": "", "port": 587, "user": "", "pass": "", "secure": false },
31
29
  "dkim": { "selector": "axium", "key_file": "" },
@@ -33,8 +31,23 @@ or delivered directly to the recipient's mail server if no relay is configured.
33
31
  }
34
32
  ```
35
33
 
34
+ Inbound receiving is configured on the plugin (`@axium/email`):
35
+
36
+ ```jsonc
37
+ {
38
+ "inbound": {
39
+ "enabled": true,
40
+ "port": 25,
41
+ "max_size": 25000, // in KB
42
+ // Override the web SSL certificate for STARTTLS
43
+ "ssl_key": "",
44
+ "ssl_cert": "",
45
+ },
46
+ }
47
+ ```
48
+
36
49
  ## CLI
37
50
 
38
- - `axium email dns` — print the DNS records you need to create.
39
- - `axium email dkim-keygen` — generate a DKIM signing key.
40
- - `axium email queue` — inspect the outbound queue (`--retry` to retry failed messages).
51
+ - `axium dkim-keygen`: generate a DKIM signing key.
52
+ - `axium email dns`: print the DNS records you need to create.
53
+ - `axium email queue`: inspect the outbound queue (`--retry` to retry failed messages).
@@ -48,6 +48,11 @@ export async function deliver(userId, folder, data, attachments = []) {
48
48
  userId,
49
49
  folder,
50
50
  ...data,
51
+ // jsonb columns must be serialized since node-postgres treats plain arrays as Postgres arrays
52
+ from: JSON.stringify(data.from),
53
+ to: JSON.stringify(data.to),
54
+ cc: JSON.stringify(data.cc),
55
+ bcc: JSON.stringify(data.bcc),
51
56
  threadId: await threadFor(userId, data.inReplyTo),
52
57
  snippet: makeSnippet(data.text),
53
58
  read: folder == 'sent' || folder == 'drafts',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/email",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Email for Axium",
6
6
  "funding": {