{"id":50484463,"url":"https://github.com/valerius21/sakura-mail","last_synced_at":"2026-06-01T20:32:05.539Z","repository":{"id":349326117,"uuid":"1201901604","full_name":"valerius21/sakura-mail","owner":"valerius21","description":"E-Mail REST/JSON API for your inbox.","archived":false,"fork":false,"pushed_at":"2026-04-05T10:25:00.000Z","size":68,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-05T12:14:06.414Z","etag":null,"topics":["email","imap","imap-client","ocaml","rest-api"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valerius21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-05T10:18:28.000Z","updated_at":"2026-04-05T10:25:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/valerius21/sakura-mail","commit_stats":null,"previous_names":["valerius21/sakura-mail"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/valerius21/sakura-mail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerius21%2Fsakura-mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerius21%2Fsakura-mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerius21%2Fsakura-mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerius21%2Fsakura-mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valerius21","download_url":"https://codeload.github.com/valerius21/sakura-mail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerius21%2Fsakura-mail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33793033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","imap","imap-client","ocaml","rest-api"],"created_at":"2026-06-01T20:32:04.861Z","updated_at":"2026-06-01T20:32:05.527Z","avatar_url":"https://github.com/valerius21.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sakura-mail\n\nHTTP API for email, built on OCaml. Wraps [mbsync](https://isync.sourceforge.io/mbsync.html) for IMAP synchronization and stores mail locally in Maildir format.\n\nTests and docs/openapi.json are AI generated.\n\n## TODO\n\n- [ ] Sending Mails\n- [ ] Queueing Mails\n\n## Prerequisites\n\n- OCaml 5.x with opam\n- [mbsync](https://isync.sourceforge.io/mbsync.html) (isync)\n- Docker (for test IMAP server)\n- Node.js (for test seed script)\n\n## Install dependencies\n\n```sh\nopam install . --deps-only\n```\n\n## Run\n\n```sh\nmake run\n```\n\nStarts on `http://localhost:8080`. Configure with environment variables:\n\n| Variable | Default | Description |\n|---|---|---|\n| `SAKURA_PORT` | `8080` | HTTP port |\n| `SAKURA_MAILDIR` | `~/.sakura-mail` | Data directory |\n\n## API\n\nAll endpoints except `POST /accounts` require `Authorization: Bearer sk_...`.\n\n```sh\n# Register an account (returns id + api_key)\ncurl -X POST http://localhost:8080/accounts \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"host\":\"imap.example.com\",\"port\":993,\"username\":\"you\",\"password\":\"pass\",\"use_tls\":true}'\n\n# Sync mail from IMAP server\ncurl -X POST http://localhost:8080/sync -H 'Authorization: Bearer sk_...'\n\n# List mailboxes\ncurl http://localhost:8080/mailboxes -H 'Authorization: Bearer sk_...'\n\n# List messages (paginated)\ncurl 'http://localhost:8080/mailboxes/INBOX/messages?limit=20\u0026offset=0' \\\n  -H 'Authorization: Bearer sk_...'\n\n# Read a message\ncurl http://localhost:8080/messages/{id} -H 'Authorization: Bearer sk_...'\n\n# Read raw RFC 5322 content\ncurl http://localhost:8080/messages/{id}/raw -H 'Authorization: Bearer sk_...'\n\n# Set flags\ncurl -X PUT http://localhost:8080/messages/{id}/flags \\\n  -H 'Authorization: Bearer sk_...' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"flags\":[\"Seen\",\"Flagged\"]}'\n\n# Move message\ncurl -X POST http://localhost:8080/messages/{id}/move \\\n  -H 'Authorization: Bearer sk_...' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"destination\":\"Archive\"}'\n\n# Delete (move to Trash)\ncurl -X DELETE http://localhost:8080/messages/{id} -H 'Authorization: Bearer sk_...'\n\n# Create draft\ncurl -X POST http://localhost:8080/drafts \\\n  -H 'Authorization: Bearer sk_...' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"to\":[\"alice@example.com\"],\"cc\":[],\"bcc\":[],\"subject\":\"Hello\",\"body\":\"Hi there\",\"in_reply_to\":null}'\n\n# Delete account\ncurl -X DELETE http://localhost:8080/accounts -H 'Authorization: Bearer sk_...'\n```\n\n## Test\n\n```sh\nmake test          # unit + e2e tests (83 total)\nmake greenmail-up  # start test IMAP server\nmake seed          # seed test emails\n```\n\n## Project structure\n\n```\nbin/              Entry point\nlib/\n  account/        User registration, API keys, persistence\n  api/            Dream HTTP routes\n  email/          RFC 5322 parsing (mrmime) and draft generation\n  imap/           mbsync CLI wrapper and .mbsyncrc generation\n  maildir/        Maildir filesystem operations\n  sync/           Background sync scheduler with per-user locking\ntest/\n  seed/           Node.js script to seed test emails via SMTP\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalerius21%2Fsakura-mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalerius21%2Fsakura-mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalerius21%2Fsakura-mail/lists"}