Roundcube Community Forum

 

paperless_attach – attach Paperless-ngx documents directly from the Roundcube co

Started by dodjango, June 02, 2026, 05:12:07 PM

Previous topic - Next topic

dodjango

What it is
I built a plugin that brings Paperless-ngx (a self-hosted document management system) into the Roundcube compose window: attach documents from Paperless directly while writing an email, instead of downloading and re-uploading them.

My typical use case: replying to an email and attaching a document I already have filed in Paperless — hit "Attach from Paperless", search, pick, send. 

What it does
 
  • "Attach from Paperless" button in the compose window
  • Search & filter by tags, correspondent, document type and date
  • Selected documents are fetched server-side and attached to the outgoing mail

Implementation notes
 
  • Roundcube 1.6, Elastic skin only; PHP 7.4+
  • Per-user API token stored encrypted (rcmail->encrypt/decrypt); the browser never sees the token or the Paperless base URL — all Paperless traffic is server-side
  • Attach happens at send time via the message_ready hook, so the download-induced session reload doesn't drop the attachment

Install
composer require dodjango/paperless_attach
Code & docs (GPL-3.0): github.com/dodjango/roundcube-paperless-attach

  Feedback welcome — issues and PRs appreciated.

dodjango

Small update — it now works both ways

In addition to attaching Paperless documents while composing, you can now save an attachment from a received email straight into Paperless without leaving Roundcube:

  • A "Save to Paperless" button on each attachment, plus one in the attachment preview toolbar (after Open).
  • The file is uploaded server-side; the plugin then polls the Paperless consume task and reports the outcome — saved ✓ / already exists (duplicate) / failed.
  • Same security model as before: the per-user API token is stored encrypted, and the token + Paperless URL never reach the browser (single server-side proxy). Roundcube 1.6.x/1.7.x · Elastic skin · PHP 7.4+.

Shipped in v1.2.0. Code, install & docs: https://github.com/dodjango/roundcube-paperless-attach — composer require dodjango/paperless_attach

Feedback and testing on other 1.6.x or 1.7.x setups is very welcome!