Author Topic: Linking directly to a mail (by message-id?)  (Read 3693 times)

Offline ssilk

  • Newbie
  • *
  • Posts: 2
Linking directly to a mail (by message-id?)
« on: June 01, 2018, 07:02:48 AM »
Hi, I'm new here and have a very special question, after digging a bit around in Roundcubes sources.

I have this use case:

- A script (we call it "bridge") scans automatically new emails into Jira-issues (Jira is a project managment tool, https://en.wikipedia.org/wiki/Jira_(software) ), for handling the incoming user requests in a defined process
- The mails may contain attachements
- I don't want to add the attachements into Jira (it's possible, but I would like to avoid that, for example the attachements can get quite big and storage on the Jira installation is more expensive than for the mails, and it is also a rare use-case that there are attachments)
- Instead I would like to generate a link to the original mail, linking to our roundcube installation, so that the user just needs to login with the right user/password to see that mail.

To generate such a link inside the bridge, I need some kind of ID, something, which roundcube knows, that that it can find that mail and display it. The first thought for such an ID is of course the "message-id", which is contained in every mail. Unfortunately roundcube doesn't know that. Instead Roundcube's internally links are to "uid", which seems to be a more or less random generated ID (I refer here to the table cache_messages).

Well, that makes sense, but how can I link in Roundcube to an email, when I just know the email and nothing else?

So here are my questions:
- Is it possible to link to an email inside roundcube just by knowing the original email (e.g. Message-ID) and nothing else? If yes: How?
- If not: Is there eventually something, which I can use to generate me that internal roundcube-uid?

Offline alec

  • Hero Member
  • *****
  • Posts: 1,363
Re: Linking directly to a mail (by message-id?)
« Reply #1 on: June 01, 2018, 01:36:48 PM »
This is not internal, this is IMAP message unique identifier. If your bridge parses messages before they are saved to the mailbox you'll likely have no access to it. So, the only possibility I see is indeed using Message-ID, but that would require writing a plugin for Rouncube. Such plugin would search the message by Message-ID to get message UID and use it to "pass" it to the message handler.

Offline ssilk

  • Newbie
  • *
  • Posts: 2
Re: Linking directly to a mail (by message-id?)
« Reply #2 on: June 16, 2018, 03:14:17 AM »
Thanks for that answer, that's nearly the same, what I found out. So I am now sure that's the way to do it (if I do it like so) :)