@atomicmail/agent-skill-openclaw 0.3.24

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.
Files changed (154) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -0
  3. package/SKILL.md +206 -0
  4. package/esm/_dnt.polyfills.d.ts +101 -0
  5. package/esm/_dnt.polyfills.d.ts.map +1 -0
  6. package/esm/_dnt.polyfills.js +127 -0
  7. package/esm/lib/agent/auth/agent-auth-http.d.ts +26 -0
  8. package/esm/lib/agent/auth/agent-auth-http.d.ts.map +1 -0
  9. package/esm/lib/agent/auth/agent-auth-http.js +85 -0
  10. package/esm/lib/agent/auth/agent-jwt.d.ts +12 -0
  11. package/esm/lib/agent/auth/agent-jwt.d.ts.map +1 -0
  12. package/esm/lib/agent/auth/agent-jwt.js +27 -0
  13. package/esm/lib/agent/auth/agent-pow.d.ts +5 -0
  14. package/esm/lib/agent/auth/agent-pow.d.ts.map +1 -0
  15. package/esm/lib/agent/auth/agent-pow.js +49 -0
  16. package/esm/lib/agent/jmap/agent-help-content.d.ts +2 -0
  17. package/esm/lib/agent/jmap/agent-help-content.d.ts.map +1 -0
  18. package/esm/lib/agent/jmap/agent-help-content.js +2 -0
  19. package/esm/lib/agent/jmap/agent-jmap-blob-limits.d.ts +27 -0
  20. package/esm/lib/agent/jmap/agent-jmap-blob-limits.d.ts.map +1 -0
  21. package/esm/lib/agent/jmap/agent-jmap-blob-limits.js +166 -0
  22. package/esm/lib/agent/jmap/agent-jmap-blob-upload.d.ts +24 -0
  23. package/esm/lib/agent/jmap/agent-jmap-blob-upload.d.ts.map +1 -0
  24. package/esm/lib/agent/jmap/agent-jmap-blob-upload.js +104 -0
  25. package/esm/lib/agent/jmap/agent-jmap-email-charset.d.ts +8 -0
  26. package/esm/lib/agent/jmap/agent-jmap-email-charset.d.ts.map +1 -0
  27. package/esm/lib/agent/jmap/agent-jmap-email-charset.js +61 -0
  28. package/esm/lib/agent/jmap/agent-jmap-run.d.ts +52 -0
  29. package/esm/lib/agent/jmap/agent-jmap-run.d.ts.map +1 -0
  30. package/esm/lib/agent/jmap/agent-jmap-run.js +260 -0
  31. package/esm/lib/agent/jmap/agent-jmap-verify.d.ts +9 -0
  32. package/esm/lib/agent/jmap/agent-jmap-verify.d.ts.map +1 -0
  33. package/esm/lib/agent/jmap/agent-jmap-verify.js +50 -0
  34. package/esm/lib/agent/jmap/agent-jmap.d.ts +89 -0
  35. package/esm/lib/agent/jmap/agent-jmap.d.ts.map +1 -0
  36. package/esm/lib/agent/jmap/agent-jmap.js +373 -0
  37. package/esm/lib/agent/jmap/agent-vars.d.ts +30 -0
  38. package/esm/lib/agent/jmap/agent-vars.d.ts.map +1 -0
  39. package/esm/lib/agent/jmap/agent-vars.js +96 -0
  40. package/esm/lib/agent/jmap/help-content/auth.d.ts +2 -0
  41. package/esm/lib/agent/jmap/help-content/auth.d.ts.map +1 -0
  42. package/esm/lib/agent/jmap/help-content/auth.js +33 -0
  43. package/esm/lib/agent/jmap/help-content/cron.d.ts +6 -0
  44. package/esm/lib/agent/jmap/help-content/cron.d.ts.map +1 -0
  45. package/esm/lib/agent/jmap/help-content/cron.js +159 -0
  46. package/esm/lib/agent/jmap/help-content/index.d.ts +6 -0
  47. package/esm/lib/agent/jmap/help-content/index.d.ts.map +1 -0
  48. package/esm/lib/agent/jmap/help-content/index.js +61 -0
  49. package/esm/lib/agent/jmap/help-content/installation.d.ts +2 -0
  50. package/esm/lib/agent/jmap/help-content/installation.d.ts.map +1 -0
  51. package/esm/lib/agent/jmap/help-content/installation.js +47 -0
  52. package/esm/lib/agent/jmap/help-content/jmap-cheatsheet.d.ts +2 -0
  53. package/esm/lib/agent/jmap/help-content/jmap-cheatsheet.d.ts.map +1 -0
  54. package/esm/lib/agent/jmap/help-content/jmap-cheatsheet.js +230 -0
  55. package/esm/lib/agent/jmap/help-content/multi-account.d.ts +2 -0
  56. package/esm/lib/agent/jmap/help-content/multi-account.d.ts.map +1 -0
  57. package/esm/lib/agent/jmap/help-content/multi-account.js +49 -0
  58. package/esm/lib/agent/jmap/help-content/overview.d.ts +2 -0
  59. package/esm/lib/agent/jmap/help-content/overview.d.ts.map +1 -0
  60. package/esm/lib/agent/jmap/help-content/overview.js +49 -0
  61. package/esm/lib/agent/jmap/help-content/presets.d.ts +2 -0
  62. package/esm/lib/agent/jmap/help-content/presets.d.ts.map +1 -0
  63. package/esm/lib/agent/jmap/help-content/presets.js +51 -0
  64. package/esm/lib/agent/jmap/help-content/tools.d.ts +2 -0
  65. package/esm/lib/agent/jmap/help-content/tools.d.ts.map +1 -0
  66. package/esm/lib/agent/jmap/help-content/tools.js +49 -0
  67. package/esm/lib/agent/jmap/help-content/troubleshooting.d.ts +2 -0
  68. package/esm/lib/agent/jmap/help-content/troubleshooting.d.ts.map +1 -0
  69. package/esm/lib/agent/jmap/help-content/troubleshooting.js +65 -0
  70. package/esm/lib/agent/session/agent-credentials-store.d.ts +45 -0
  71. package/esm/lib/agent/session/agent-credentials-store.d.ts.map +1 -0
  72. package/esm/lib/agent/session/agent-credentials-store.js +121 -0
  73. package/esm/lib/agent/session/agent-resolve-config.d.ts +29 -0
  74. package/esm/lib/agent/session/agent-resolve-config.d.ts.map +1 -0
  75. package/esm/lib/agent/session/agent-resolve-config.js +71 -0
  76. package/esm/lib/agent/session/agent-session-for-dir.d.ts +8 -0
  77. package/esm/lib/agent/session/agent-session-for-dir.d.ts.map +1 -0
  78. package/esm/lib/agent/session/agent-session-for-dir.js +33 -0
  79. package/esm/lib/agent/session/agent-session.d.ts +89 -0
  80. package/esm/lib/agent/session/agent-session.d.ts.map +1 -0
  81. package/esm/lib/agent/session/agent-session.js +320 -0
  82. package/esm/lib/agent/session/inbox-id-to-mailbox-email.d.ts +6 -0
  83. package/esm/lib/agent/session/inbox-id-to-mailbox-email.d.ts.map +1 -0
  84. package/esm/lib/agent/session/inbox-id-to-mailbox-email.js +21 -0
  85. package/esm/lib/core/consts.d.ts +17 -0
  86. package/esm/lib/core/consts.d.ts.map +1 -0
  87. package/esm/lib/core/consts.js +28 -0
  88. package/esm/lib/core/jmap-hints.d.ts +3 -0
  89. package/esm/lib/core/jmap-hints.d.ts.map +1 -0
  90. package/esm/lib/core/jmap-hints.js +6 -0
  91. package/esm/lib/core/messages.d.ts +6 -0
  92. package/esm/lib/core/messages.d.ts.map +1 -0
  93. package/esm/lib/core/messages.js +19 -0
  94. package/esm/lib/core/read-npm-package-readme.d.ts +6 -0
  95. package/esm/lib/core/read-npm-package-readme.d.ts.map +1 -0
  96. package/esm/lib/core/read-npm-package-readme.js +81 -0
  97. package/esm/lib/core/shared-assets.d.ts +6 -0
  98. package/esm/lib/core/shared-assets.d.ts.map +1 -0
  99. package/esm/lib/core/shared-assets.js +46 -0
  100. package/esm/lib/core/types.d.ts +2 -0
  101. package/esm/lib/core/types.d.ts.map +1 -0
  102. package/esm/lib/core/types.js +2 -0
  103. package/esm/lib/core/utils.d.ts +12 -0
  104. package/esm/lib/core/utils.d.ts.map +1 -0
  105. package/esm/lib/core/utils.js +29 -0
  106. package/esm/lib/integrations/create-agent-session.d.ts +25 -0
  107. package/esm/lib/integrations/create-agent-session.d.ts.map +1 -0
  108. package/esm/lib/integrations/create-agent-session.js +36 -0
  109. package/esm/lib/integrations/key-value-credential-store.d.ts +21 -0
  110. package/esm/lib/integrations/key-value-credential-store.d.ts.map +1 -0
  111. package/esm/lib/integrations/key-value-credential-store.js +71 -0
  112. package/esm/lib/integrations/n8n-credential-store.d.ts +18 -0
  113. package/esm/lib/integrations/n8n-credential-store.d.ts.map +1 -0
  114. package/esm/lib/integrations/n8n-credential-store.js +62 -0
  115. package/esm/lib/mod.d.ts +23 -0
  116. package/esm/lib/mod.d.ts.map +1 -0
  117. package/esm/lib/mod.js +22 -0
  118. package/esm/lib/network/auth-client.d.ts +57 -0
  119. package/esm/lib/network/auth-client.d.ts.map +1 -0
  120. package/esm/lib/network/auth-client.js +210 -0
  121. package/esm/package.json +3 -0
  122. package/esm/skill/cli.d.ts +3 -0
  123. package/esm/skill/cli.d.ts.map +1 -0
  124. package/esm/skill/cli.js +321 -0
  125. package/package.json +45 -0
  126. package/presets/list_inbox.json +46 -0
  127. package/presets/reply.json +97 -0
  128. package/presets/send_mail.json +70 -0
  129. package/presets/send_mail_attachment.json +92 -0
  130. package/presets/send_mail_blob_attachment.json +74 -0
  131. package/shared/consts.json +11 -0
  132. package/shared/fixtures/pow_vectors.json +32 -0
  133. package/shared/help/fragments/inbox_cron_agent_prompt.md +1 -0
  134. package/shared/help/fragments/post_register_cron_reminder.md +5 -0
  135. package/shared/help/readme_stub.md +3 -0
  136. package/shared/help/topics/auth.md +8 -0
  137. package/shared/help/topics/cron.md +217 -0
  138. package/shared/help/topics/installation.md +35 -0
  139. package/shared/help/topics/jmap_cheatsheet.md +19 -0
  140. package/shared/help/topics/multi_account.md +9 -0
  141. package/shared/help/topics/overview.md +27 -0
  142. package/shared/help/topics/presets.md +12 -0
  143. package/shared/help/topics/tools.md +16 -0
  144. package/shared/help/topics/troubleshooting.md +6 -0
  145. package/shared/manifest.json +31 -0
  146. package/shared/messages/errors.json +68 -0
  147. package/shared/messages/hints.json +8 -0
  148. package/shared/presets/list_inbox.json +46 -0
  149. package/shared/presets/reply.json +97 -0
  150. package/shared/presets/send_mail.json +70 -0
  151. package/shared/presets/send_mail_attachment.json +92 -0
  152. package/shared/presets/send_mail_blob_attachment.json +74 -0
  153. package/shared/skill/SKILL.template.md +202 -0
  154. package/shared/skill/manifest.json +89 -0
@@ -0,0 +1,27 @@
1
+ # Atomic Mail — Overview
2
+
3
+ Atomic Mail is an email service provider (ESP) designed for AI agents. You manage
4
+ mail over JMAP (RFC 8620 + RFC 8621).
5
+
6
+ ## Public surface
7
+
8
+ Three operations only:
9
+
10
+ 1. **register** — proof-of-work signup with optional idempotent replay.
11
+ 2. **jmap_request** — run JMAP method-call batches with auth + JWT rotation.
12
+ 3. **help** — read built-in docs and package README.
13
+
14
+ ## Typical workflow
15
+
16
+ 1. Register with a username (5–21 chars).
17
+ 2. After register, arrange hourly inbox polling per your runtime (see **cron**
18
+ topic — native scheduler if available; otherwise ask your operator or remind
19
+ manual fetch). Do not cron `atomicmail jmap_request` alone.
20
+ 3. Use `jmap_request` with `ops` or `ops_file`; supply `vars` as needed.
21
+ 4. Use `help` topics before guessing protocol details.
22
+
23
+ AFTER REGISTER — INBOX POLLING
24
+ Choose the path that matches your runtime (help topic "cron"):
25
+ • Native cron (OpenClaw, Hermes, atomic-agent, …): schedule an hourly AGENT turn with list_inbox.json in the prompt; wire MCP or AgentSkill into that agent. Do NOT cron atomicmail jmap_request alone.
26
+ • No native cron (Claude, Pi, Cursor, …): do NOT work around this (no wrapper scripts, OS crontab/LaunchAgent, or cross-platform scheduling). Ask your operator to set up polling on a capable host, or remind them to fetch mail manually when needed.
27
+ • Forbidden: register in one runtime and schedule the cron job on another.
@@ -0,0 +1,12 @@
1
+ # JMAP presets
2
+
3
+ Bundled presets:
4
+
5
+ - `send_mail.json`
6
+ - `list_inbox.json`
7
+ - `reply.json`
8
+ - `send_mail_attachment.json`
9
+ - `send_mail_blob_attachment.json`
10
+
11
+ Relative `ops_file` paths resolve from credentials directory first, then bundled
12
+ presets shipped with the package.
@@ -0,0 +1,16 @@
1
+ # Tool / CLI reference
2
+
3
+ ## register
4
+
5
+ - MCP: `{ "username": string, "credentials_dir"?: string, "forced"?: boolean }`
6
+ - Skill: `register --username NAME [--credentials-dir DIR] [--forced]`
7
+
8
+ ## jmap_request
9
+
10
+ - MCP: one of `ops` or `ops_file`, optional `vars`, optional `attachments`.
11
+ - Skill: one of `--ops` or `--ops-file`, optional `--vars`, `--attachment`.
12
+
13
+ ## help
14
+
15
+ - MCP: `{ "topic"?: string }`
16
+ - Skill: `help [--topic TOPIC]`
@@ -0,0 +1,6 @@
1
+ # Troubleshooting
2
+
3
+ - Missing API key: run `register` or provide valid credentials.
4
+ - Wrong `inMailbox`: use `$INBOX_MAILBOX_ID` (mailbox id), not inbox email.
5
+ - Blob/upload shape errors: `data` must be an array of datasource objects.
6
+ - Missing variables (`$TO`, etc.): provide them via `vars` / `--vars`.
@@ -0,0 +1,31 @@
1
+ {
2
+ "version": 1,
3
+ "compat": {
4
+ "ts_min": "0.0.0"
5
+ },
6
+ "consts_path": "consts.json",
7
+ "messages": {
8
+ "errors_path": "messages/errors.json",
9
+ "hints_path": "messages/hints.json"
10
+ },
11
+ "presets_dir": "presets",
12
+ "help": {
13
+ "readme_stub_path": "help/readme_stub.md",
14
+ "topics_dir": "help/topics",
15
+ "fragments_dir": "help/fragments",
16
+ "topic_order": [
17
+ "overview",
18
+ "installation",
19
+ "auth",
20
+ "jmap_cheatsheet",
21
+ "tools",
22
+ "presets",
23
+ "cron",
24
+ "multi_account",
25
+ "troubleshooting"
26
+ ]
27
+ },
28
+ "fixtures": {
29
+ "pow_vectors_path": "fixtures/pow_vectors.json"
30
+ }
31
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "mcp_ops_mutually_exclusive": "ops and ops_file are mutually exclusive — provide one.",
3
+ "mcp_ops_required": "Provide either ops or ops_file.",
4
+ "cli_ops_mutually_exclusive": "--ops and --ops-file are mutually exclusive.",
5
+ "cli_ops_required": "Provide --ops or --ops-file.",
6
+ "cli_dry_run_with_attachment": "--dry-run cannot be combined with --attachment.",
7
+ "cli_unknown_command_template": "Unknown command: {cmd}",
8
+ "help_unknown_topic_template": "Unknown topic \"{topic}\". Available topics: {topics}, readme",
9
+ "help_readme_stub": "Topic \"readme\" returns a built-in stub in AgentSkill runtimes. From MCP, topic \"readme\" returns package README.md.",
10
+ "vars_invalid_json_template": "--vars is not valid JSON: {details}",
11
+ "vars_not_object": "--vars must be a JSON object of { VAR_NAME: string }.",
12
+ "vars_key_invalid_template": "--vars key '{key}' must match /^[A-Z][A-Z0-9_]*$/.",
13
+ "vars_value_not_string_template": "--vars value for '{key}' must be a string.",
14
+ "vars_missing_template": "Missing values for variables: {vars}. Pass custom placeholders in vars (MCP) or --vars (skill).",
15
+ "vars_missing_session_suffix": " For $ACCOUNT_ID, $INBOX, and $INBOX_MAILBOX_ID, ensure register completed and credentials are valid, or pass overrides in vars.",
16
+ "jmap_json_invalid_template": "{source} is not valid JSON: {details}",
17
+ "jmap_envelope_invalid_template": "{source} must be a methodCalls array, e.g. [[\"Mailbox/get\",{...},\"m0\"]], or an object with a methodCalls array.",
18
+ "jmap_ops_file_not_found_template": "ops_file '{ops_file}' not found under credential directory ({path}) and not among bundled presets: {presets}.",
19
+ "jmap_session_missing_primary_accounts": "JMAP session missing primaryAccounts.",
20
+ "jmap_session_missing_primary_mail_template": "JMAP session missing primaryAccounts['{urn}'].",
21
+ "jmap_session_missing_upload_url": "JMAP session missing uploadUrl.",
22
+ "jmap_session_missing_download_url": "JMAP session missing downloadUrl.",
23
+ "jmap_session_missing_api_url": "JMAP session missing apiUrl.",
24
+ "jmap_session_fetch_failed_template": "JMAP session fetch failed (HTTP {status}): {body}",
25
+ "jmap_session_response_not_json": "JMAP session response is not valid JSON.",
26
+ "jmap_dry_run_with_attachments": "dryRun cannot be used with attachments: RFC 8620 upload runs first and would create blobs.",
27
+ "mailbox_query_failed_http_template": "Mailbox/query failed (HTTP {status}): {body}",
28
+ "mailbox_query_response_not_json": "Mailbox/query response is not valid JSON.",
29
+ "mailbox_query_failed_template": "Mailbox/query failed: {body}",
30
+ "mailbox_query_missing_inbox_id": "Mailbox/query returned no inbox mailbox id.",
31
+ "agent_username_length": "Username must be 5–21 characters.",
32
+ "agent_register_api_key_without_inbox": "Cannot register: an API key is configured but inboxId is unknown. Fix credentials.json or unset ATOMIC_MAIL_API_KEY before registering.",
33
+ "agent_register_refused_existing_credentials_template": "Register refused because credentials already belong to \"{inbox}\" and requested username is \"{username}\". Alternatively, use a separate credential directory (credentials_dir in MCP / --credentials-dir in AgentSkill) to register another account without replacing the current one. If you want to replace credentials in this directory, first back it up and remember where you copied it, otherwise you may lose access to your old account. Then retry with forced=true (MCP) or --forced (AgentSkill).",
34
+ "agent_signup_missing_api_key": "Signup did not return an apiKey — this indicates a server bug.",
35
+ "agent_capability_missing_inbox_signup": "Capability JWT missing inboxId claim after signup.",
36
+ "agent_jmap_session_missing_urls": "JMAP session did not provide uploadUrl, downloadUrl, or apiUrl.",
37
+ "agent_internal_missing_session_jwt": "Internal: ensureSession() left sessionJWT unset.",
38
+ "agent_missing_api_key_or_session": "No API key configured and no valid session on disk. Run register first, set ATOMIC_MAIL_API_KEY, or place credentials.json in the credential directory.",
39
+ "agent_capability_missing_inbox": "Capability JWT did not contain an inboxId claim.",
40
+ "agent_jmap_cache_missing": "JMAP session cache missing after refresh.",
41
+ "credentials_invalid_json_template": "Could not parse credentials JSON at {path}: {details}",
42
+ "credentials_invalid_shape_template": "Invalid credentials JSON at {path}: expected string fields apiKey, inboxId, authUrl, apiUrl, scryptSalt, uploadUrl, downloadUrl.",
43
+ "credentials_write_failed_template": "Failed to write credentials at {path}: {details}",
44
+ "credentials_file_missing_template": "No credentials found in {dir}. Run register first or pass credentials_dir.",
45
+ "resolve_config_missing_credentials_dir_template": "No credentials found for command \"{command}\" in credentials_dir \"{dir}\". Run register for that directory first.",
46
+ "readme_missing_template": "README.md was not found in this package install. Tried: {paths}",
47
+ "jwt_malformed": "Malformed JWT: expected at least 2 dot-separated segments.",
48
+ "auth_missing_challenge_bearer": "Challenge response missing Authorization bearer token.",
49
+ "auth_missing_session_bearer": "Session response missing Authorization bearer token.",
50
+ "auth_missing_capability_bearer": "Capability response missing Authorization bearer token.",
51
+ "auth_header_not_bearer": "Authorization header must use Bearer scheme.",
52
+ "auth_challenge_payload_malformed": "Challenge JWT payload is malformed (missing jti or difficulty).",
53
+ "auth_session_non_json": "auth-service /api/v1/session returned non-JSON body.",
54
+ "auth_client_signup_missing_api_key": "Signup response missing apiKey.",
55
+ "jmap_verify_not_json": "JMAP response was not JSON; cannot verify submission.",
56
+ "jmap_verify_missing_method_responses": "JMAP response JSON missing methodResponses array.",
57
+ "blob_upload_path_not_readable_template": "Attachment path is not readable: {path}",
58
+ "blob_upload_missing_blob_id_template": "Upload response missing blobId: {response}",
59
+ "blob_limits_no_data_sources": "Blob/upload create entry must contain a data array with at least one source.",
60
+ "blob_limits_invalid_data_source": "Blob/upload data source must contain exactly one of data:asText, data:asBase64, or blobId.",
61
+ "blob_limits_as_text_not_string": "Blob/upload data:asText must be a string.",
62
+ "blob_limits_as_base64_not_string": "Blob/upload data:asBase64 must be a string.",
63
+ "blob_limits_blob_id_invalid": "Blob/upload blobId must be a non-empty string.",
64
+ "blob_limits_too_large_template": "Blob/upload create key '{key}' exceeds maxSizeBlobSet={max}: estimated {size} bytes.",
65
+ "blob_limits_too_many_sources_template": "Blob/upload create key '{key}' exceeds maxDataSources={max}: found {count}.",
66
+ "blob_limits_batch_too_large_template": "Blob/upload envelope exceeds maxSizeBlobSet for account '{accountId}': estimated {size} bytes > {max}.",
67
+ "send_big_attachment_missing_inbox": "No inbox in session; run register first."
68
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "jmap_next_hints": [
3
+ "Use jmap_request with Mailbox/get or Email/query to work with mail data.",
4
+ "Use presets with $VAR placeholders — $ACCOUNT_ID, $INBOX, and $INBOX_MAILBOX_ID come from the session; pass others via vars / --vars.",
5
+ "Call help for the JMAP cheatsheet and troubleshooting."
6
+ ],
7
+ "post_register_cron_reminder": "After register, arrange hourly inbox polling per help topic cron: native scheduler if available; otherwise ask operator or remind manual fetch. Do not cron jmap_request alone."
8
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "using": [
3
+ "urn:ietf:params:jmap:core",
4
+ "urn:ietf:params:jmap:mail"
5
+ ],
6
+ "methodCalls": [
7
+ [
8
+ "Email/query",
9
+ {
10
+ "accountId": "$ACCOUNT_ID",
11
+ "filter": {
12
+ "inMailbox": "$INBOX_MAILBOX_ID"
13
+ },
14
+ "sort": [
15
+ {
16
+ "property": "receivedAt",
17
+ "isAscending": false
18
+ }
19
+ ],
20
+ "limit": 50
21
+ },
22
+ "q0"
23
+ ],
24
+ [
25
+ "Email/get",
26
+ {
27
+ "accountId": "$ACCOUNT_ID",
28
+ "#ids": {
29
+ "resultOf": "q0",
30
+ "name": "Email/query",
31
+ "path": "/ids"
32
+ },
33
+ "properties": [
34
+ "id",
35
+ "threadId",
36
+ "receivedAt",
37
+ "from",
38
+ "to",
39
+ "subject",
40
+ "preview"
41
+ ]
42
+ },
43
+ "g0"
44
+ ]
45
+ ]
46
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "using": [
3
+ "urn:ietf:params:jmap:core",
4
+ "urn:ietf:params:jmap:mail",
5
+ "urn:ietf:params:jmap:submission"
6
+ ],
7
+ "methodCalls": [
8
+ [
9
+ "Email/get",
10
+ {
11
+ "accountId": "$ACCOUNT_ID",
12
+ "ids": [
13
+ "$MAIL_ID"
14
+ ],
15
+ "properties": [
16
+ "id",
17
+ "threadId",
18
+ "from",
19
+ "replyTo",
20
+ "subject",
21
+ "messageId"
22
+ ]
23
+ },
24
+ "g0"
25
+ ],
26
+ [
27
+ "Email/set",
28
+ {
29
+ "accountId": "$ACCOUNT_ID",
30
+ "create": {
31
+ "d1": {
32
+ "mailboxIds": {
33
+ "$INBOX_MAILBOX_ID": true
34
+ },
35
+ "from": [
36
+ {
37
+ "email": "$INBOX"
38
+ }
39
+ ],
40
+ "#to": {
41
+ "resultOf": "g0",
42
+ "name": "Email/get",
43
+ "path": "/list/0/replyTo"
44
+ },
45
+ "#subject": {
46
+ "resultOf": "g0",
47
+ "name": "Email/get",
48
+ "path": "/list/0/subject"
49
+ },
50
+ "#inReplyTo": {
51
+ "resultOf": "g0",
52
+ "name": "Email/get",
53
+ "path": "/list/0/messageId"
54
+ },
55
+ "textBody": [
56
+ {
57
+ "partId": "b",
58
+ "type": "text/plain"
59
+ }
60
+ ],
61
+ "bodyValues": {
62
+ "b": {
63
+ "value": "$BODY"
64
+ }
65
+ },
66
+ "keywords": {
67
+ "$draft": true
68
+ }
69
+ }
70
+ }
71
+ },
72
+ "c0"
73
+ ],
74
+ [
75
+ "EmailSubmission/set",
76
+ {
77
+ "accountId": "$ACCOUNT_ID",
78
+ "create": {
79
+ "s1": {
80
+ "emailId": "#d1",
81
+ "envelope": {
82
+ "mailFrom": {
83
+ "email": "$INBOX"
84
+ },
85
+ "#rcptTo": {
86
+ "resultOf": "g0",
87
+ "name": "Email/get",
88
+ "path": "/list/0/replyTo"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "c1"
95
+ ]
96
+ ]
97
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "using": [
3
+ "urn:ietf:params:jmap:core",
4
+ "urn:ietf:params:jmap:mail",
5
+ "urn:ietf:params:jmap:submission"
6
+ ],
7
+ "methodCalls": [
8
+ [
9
+ "Email/set",
10
+ {
11
+ "accountId": "$ACCOUNT_ID",
12
+ "create": {
13
+ "d1": {
14
+ "mailboxIds": {
15
+ "$INBOX_MAILBOX_ID": true
16
+ },
17
+ "from": [
18
+ {
19
+ "email": "$INBOX"
20
+ }
21
+ ],
22
+ "to": [
23
+ {
24
+ "email": "$TO"
25
+ }
26
+ ],
27
+ "subject": "$SUBJECT",
28
+ "textBody": [
29
+ {
30
+ "partId": "b",
31
+ "type": "text/plain"
32
+ }
33
+ ],
34
+ "bodyValues": {
35
+ "b": {
36
+ "value": "$BODY"
37
+ }
38
+ },
39
+ "keywords": {
40
+ "$draft": true
41
+ }
42
+ }
43
+ }
44
+ },
45
+ "c0"
46
+ ],
47
+ [
48
+ "EmailSubmission/set",
49
+ {
50
+ "accountId": "$ACCOUNT_ID",
51
+ "create": {
52
+ "s1": {
53
+ "emailId": "#d1",
54
+ "envelope": {
55
+ "mailFrom": {
56
+ "email": "$INBOX"
57
+ },
58
+ "rcptTo": [
59
+ {
60
+ "email": "$TO"
61
+ }
62
+ ]
63
+ }
64
+ }
65
+ }
66
+ },
67
+ "c1"
68
+ ]
69
+ ]
70
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "using": [
3
+ "urn:ietf:params:jmap:core",
4
+ "urn:ietf:params:jmap:mail",
5
+ "urn:ietf:params:jmap:submission",
6
+ "urn:ietf:params:jmap:blob"
7
+ ],
8
+ "methodCalls": [
9
+ [
10
+ "Blob/upload",
11
+ {
12
+ "accountId": "$ACCOUNT_ID",
13
+ "create": {
14
+ "b1": {
15
+ "data": [
16
+ {
17
+ "data:asBase64": "$ATTACHMENT_BASE64"
18
+ }
19
+ ],
20
+ "type": "$ATTACHMENT_TYPE"
21
+ }
22
+ }
23
+ },
24
+ "b0"
25
+ ],
26
+ [
27
+ "Email/set",
28
+ {
29
+ "accountId": "$ACCOUNT_ID",
30
+ "create": {
31
+ "m1": {
32
+ "mailboxIds": {
33
+ "$INBOX_MAILBOX_ID": true
34
+ },
35
+ "from": [
36
+ {
37
+ "email": "$INBOX"
38
+ }
39
+ ],
40
+ "to": [
41
+ {
42
+ "email": "$TO"
43
+ }
44
+ ],
45
+ "subject": "$SUBJECT",
46
+ "bodyValues": {
47
+ "body1": {
48
+ "value": "$BODY"
49
+ }
50
+ },
51
+ "textBody": [
52
+ {
53
+ "partId": "body1",
54
+ "type": "text/plain"
55
+ }
56
+ ],
57
+ "attachments": [
58
+ {
59
+ "blobId": "#b1",
60
+ "type": "$ATTACHMENT_TYPE",
61
+ "name": "$ATTACHMENT_NAME"
62
+ }
63
+ ]
64
+ }
65
+ }
66
+ },
67
+ "m0"
68
+ ],
69
+ [
70
+ "EmailSubmission/set",
71
+ {
72
+ "accountId": "$ACCOUNT_ID",
73
+ "create": {
74
+ "s1": {
75
+ "emailId": "#m1",
76
+ "envelope": {
77
+ "mailFrom": {
78
+ "email": "$INBOX"
79
+ },
80
+ "rcptTo": [
81
+ {
82
+ "email": "$TO"
83
+ }
84
+ ]
85
+ }
86
+ }
87
+ }
88
+ },
89
+ "s0"
90
+ ]
91
+ ]
92
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "using": [
3
+ "urn:ietf:params:jmap:core",
4
+ "urn:ietf:params:jmap:mail",
5
+ "urn:ietf:params:jmap:submission"
6
+ ],
7
+ "methodCalls": [
8
+ [
9
+ "Email/set",
10
+ {
11
+ "accountId": "$ACCOUNT_ID",
12
+ "create": {
13
+ "m1": {
14
+ "mailboxIds": {
15
+ "$INBOX_MAILBOX_ID": true
16
+ },
17
+ "from": [
18
+ {
19
+ "email": "$INBOX"
20
+ }
21
+ ],
22
+ "to": [
23
+ {
24
+ "email": "$TO"
25
+ }
26
+ ],
27
+ "subject": "$SUBJECT",
28
+ "bodyValues": {
29
+ "body1": {
30
+ "value": "$BODY"
31
+ }
32
+ },
33
+ "textBody": [
34
+ {
35
+ "partId": "body1",
36
+ "type": "text/plain"
37
+ }
38
+ ],
39
+ "attachments": [
40
+ {
41
+ "blobId": "$ATTACHMENT_0_BLOB_ID",
42
+ "type": "$ATTACHMENT_0_TYPE",
43
+ "name": "$ATTACHMENT_0_NAME"
44
+ }
45
+ ]
46
+ }
47
+ }
48
+ },
49
+ "m0"
50
+ ],
51
+ [
52
+ "EmailSubmission/set",
53
+ {
54
+ "accountId": "$ACCOUNT_ID",
55
+ "create": {
56
+ "s1": {
57
+ "emailId": "#m1",
58
+ "envelope": {
59
+ "mailFrom": {
60
+ "email": "$INBOX"
61
+ },
62
+ "rcptTo": [
63
+ {
64
+ "email": "$TO"
65
+ }
66
+ ]
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "s0"
72
+ ]
73
+ ]
74
+ }