Skip to content

feat: mail the signed document to chosen signers and archive addresses - #9548

Open
no84by wants to merge 1 commit into
LibreSign:mainfrom
no84by:feat/mail-signed-copy
Open

no84by wants to merge 1 commit into
LibreSign:mainfrom
no84by:feat/mail-signed-copy

Conversation

@no84by

@no84by no84by commented Nov 18, 2026 •

Copy link
Copy Markdown

Resolves: #9545
Related: #7986 (separate completion notifications), #8497 (completion callback).

Summary

Adds an opt-in way to mail the fully signed PDF after the last signature. Today only the requester gets a "document signed" link.

  • New policy signed_copy_mail (system/group/user, disabled by default): {"enabled": bool, "archive_addresses": [..]}.
  • New signer field sendSignedCopy (API + a switch in the signer editor, shown only while the policy is enabled for the requester).
  • On the existing SigningRequestCompletedEvent, one delivery per recipient is registered in the notification delivery outbox (signed_copy event, mail channel) and sent by DeliverNotification, so attempts are recorded, lost jobs are recovered by RecoverPendingNotifications, and the outcome webhook applies. Chosen signers get the documents they signed, archive addresses get every document; for an envelope this is one mail per recipient with all of their documents.
  • The delivery key is derived from the request and the recipient, so a repeated completion never mails a recipient twice.
  • The PDFs are read at send time (the queue stores only document ids). Attachments over 15 MiB per mail (about 20 MiB after encoding), or an unreadable signed file, fall back to a link to the validation page. Splitting was left out to keep one mail per recipient and no partial state.
  • Deliveries are always queued, also in synchronous delivery mode, so large attachments are never read inside the signing request.

Existing installs: nothing changes until an admin enables the policy.

How to test

  1. Administration settings → LibreSign → enable "Email the signed document", optionally add archive addresses.
  2. Request signatures, open a signer and enable "Email the signed document to this signer".
  3. Sign by all parties, run cron: the chosen signer and the archive addresses get the PDF attached.
  4. Repeat with an envelope of two files.

Validation evidence

  • Focused regression/acceptance test (SignedCopyMailServiceTest incl. a repeated completion, SignedCopyAttachmentProviderTest, NotificationChannelsTest, SignedCopyMailPolicyTest, SignedCopyMailPolicyValueTest, SignedCopyMailListenerTest, new cases in MailServiceTest, RequestSignatureServiceTest, FileListServiceTest; Vitest specs for the policy module, IdentifySigner, files store)
  • Relevant lint/type/static-analysis checks (php-cs-fixer, ts:check, eslint, lint:translator-hints)
  • Broader suite required by the changed surface (PHPUnit unit suite, OpenAPI tests)
  • CI reviewed

UI / Front-end changes

  • New policy card "Email the signed document" (switch + archive addresses field)

  • New switch in the signer editor

  • Screenshots before/after added for user-visible changes

  • Component/unit (Vitest) tests added or updated

  • Documentation updated when applicable

API / Back-end changes

  • sendSignedCopy on NewSigner (request) and on signer details (returned only to the requester)
  • Unit tests added or updated
  • Authorization and negative paths checked when applicable
  • API documentation regenerated with composer openapi

Checklist

  • I have read and followed the contribution guide.
  • The diff does not contain unrelated refactors or generated changes.
  • Commits follow Conventional Commits where applicable.
  • All commits include the required DCO sign-off.

AI (if applicable)

  • The content of this PR was partially or fully generated using AI

Add the signed_copy_mail policy (disabled by default). When enabled for
the requester, a completed request queues one mail per recipient in the
notification delivery outbox:

- each signer the requester chose with the new sendSignedCopy signer
  field (a switch in the signer editor);
- the optional archive addresses configured in the policy.

For an envelope each recipient gets one mail with all of their
documents: a signer gets the documents they signed, archive addresses
get every document. The delivery key is derived from the request and
the recipient, so a repeated completion never mails a recipient twice.

The DeliverNotification job reads the signed PDFs at send time. When
the documents of one mail exceed 15 MiB, or a signed file cannot be
read, the mail links to the validation page instead.

Signed-off-by: no84by <50858621+no84by@users.noreply.github.com>
@no84by
no84by requested a review from a team as a code owner November 18, 2026 13:34
@welcome

welcome Bot commented Nov 18, 2026

Copy link
Copy Markdown

Thanks for opening your first pull request in this repository! ✌️

@no84by

no84by commented Nov 18, 2026 •

Copy link
Copy Markdown
Author

Overview of a related set of changes, each reviewable on its own:

PR What Builds on
#9539 fix: restore folder service user and skip already signed children in envelopes none
#9552 fix: never certify a document that is already signed (native engine, JSignPdf) none
#9548 feat: mail the signed document to chosen signers and archive addresses (#9545) none
#9549 feat: per-signer language for e-mails (#9546) none
#9553 feat: organization seals after the last signature (#9547) #9552
#9550 feat: default ink color for the draw signature pad none
#9551 fix: typed signature on one line at the largest size that fits none
#9555 fix: upload crop default size in image pixels (#9526) none
#9554 fix: read system policy values with their stored AppConfig type (#9456) none
#9556 fix: accept DSS and document timestamp updates after certification (#9534) none

Screenshots for the UI changes follow in each PR.

@no84by

no84by commented Nov 18, 2026

Copy link
Copy Markdown
Author

Screenshots (test instance on main 7a8403d vs this branch, light and dark theme):

Policy card "Email the signed document" (enabled, archive addresses)

Before (light) After (light)
before after
Before (dark) After (dark)
before after

Add-signer dialog: new switch

Before (light) After (light)
before after
Before (dark) After (dark)
before after

Mail after the last signature: signed PDF attached

Before (light) After (light)
before after
Before (dark) After (dark)
before after

Link fallback for a large document

Before (light) After (light)
(not present on main) after
Before (dark) After (dark)
(not present on main) after

Rule dialog with the switch and archive addresses

Before (light) After (light)
(not present on main) after
Before (dark) After (dark)
(not present on main) after

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mail the signed document to chosen signers and archive addresses

1 participant