Skip to content

feat: Add route to open messages via Message-ID#12632

Open
SoleroTG wants to merge 2 commits intonextcloud:mainfrom
SoleroTG:feature/message-id-deeplink
Open

feat: Add route to open messages via Message-ID#12632
SoleroTG wants to merge 2 commits intonextcloud:mainfrom
SoleroTG:feature/message-id-deeplink

Conversation

@SoleroTG
Copy link
Copy Markdown

Related to #2269

Hi @ChristophWurst, this is the first part of the deep-linking feature.

What this PR does

This PR introduces a new frontend route /apps/mail/open/<message-id> that allows opening a specific email directly if the Message-ID is known.

The app will search for a message with the given ID across all accounts and mailboxes of the user and open it if found.

This is the foundational work for a future UI element that will allow users to copy such a link. The button for generating the link is not part of this PR and will follow in a separate one.

How to test

  1. Find a Message-ID of an existing email (e.g., from the email source).
  2. Manually construct a URL like http://<your-nextcloud-instance>/index.php/apps/mail/open/<your-message-id>.
  3. Make sure to URL-encode the Message-ID (e.g., < becomes %3C).
  4. Navigate to the URL.
  5. The Mail app should open and display the corresponding email directly.

Signed-off-by: SoleroTG <github-29h@solero.quietmail.eu>
Signed-off-by: SoleroTG <github-29h@solero.quietmail.eu>
@SoleroTG SoleroTG force-pushed the feature/message-id-deeplink branch from 4366c3a to a38f75a Compare March 21, 2026 00:11
declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors

Comment on lines +33 to +38
MailAccountMapper $mailAccountMapper,
AccountService $accountService,
MessageMapper $messageMapper,
IURLGenerator $urlGenerator,
IUserSession $userSession,
LoggerInterface $logger
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MailAccountMapper $mailAccountMapper,
AccountService $accountService,
MessageMapper $messageMapper,
IURLGenerator $urlGenerator,
IUserSession $userSession,
LoggerInterface $logger
private MailAccountMapper $mailAccountMapper,
private AccountService $accountService,
private MessageMapper $messageMapper,
private IURLGenerator $urlGenerator,
private IUserSession $userSession,
private LoggerInterface $logger

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding private/protected/public in a class constructor = shortcut to create a property with the given name and assign the value to it.

Comment on lines +23 to +28
private MailAccountMapper $mailAccountMapper;
private AccountService $accountService;
private MessageMapper $messageMapper;
private IURLGenerator $urlGenerator;
private IUserSession $userSession;
private LoggerInterface $logger;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MailAccountMapper $mailAccountMapper;
private AccountService $accountService;
private MessageMapper $messageMapper;
private IURLGenerator $urlGenerator;
private IUserSession $userSession;
private LoggerInterface $logger;

Comment on lines +41 to +46
$this->mailAccountMapper = $mailAccountMapper;
$this->accountService = $accountService;
$this->messageMapper = $messageMapper;
$this->urlGenerator = $urlGenerator;
$this->userSession = $userSession;
$this->logger = $logger;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->mailAccountMapper = $mailAccountMapper;
$this->accountService = $accountService;
$this->messageMapper = $messageMapper;
$this->urlGenerator = $urlGenerator;
$this->userSession = $userSession;
$this->logger = $logger;

/**
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @PublicPage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a public page


/**
* @NoAdminRequired
* @NoCSRFRequired
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @NoCSRFRequired

@kesselb
Copy link
Copy Markdown
Contributor

kesselb commented Mar 30, 2026

Thanks a lot for your pr, I will give it a test this week.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants