Apple Mail DEVONThink extension: Can I launch the original message from DT?

I just successfully added the Apple Mail DEVONThink extension and am successfully sending messages to my DT. Is it possible to launch the original email message from DT in mail? When I choose Launch it just opens a new email message to the address of the person who originally sent the message. Thank you!

Yes, by either using a script that changes the record’s URL or by using a script to open the mail without changing the record’s URL.

See thread Backlinks for emails.

2 Likes

Not the “original message”, but for .eml files archived in Devonthink
I right-click and Open in Mail

1 Like

Thank you, this works! Do you happen to know if it’s possible to create a keyboard shortcut for this command?

You can assign a shortcut by adding e.g. ___SHIFT + OPT + CMD + W to the filename.

While this is true, we actually advocate assigning a keyboard shortcut in the System Preferences or more easily via CustomShortcuts.

1 Like

This is how I do it – everything is built in by default:

  1. If I want just to open the .eml file in DT3’s wrapper, select the file then: ⌘-o (“open”).

  2. If I want to open the original email, select the file then: ⌘-Shift-o. This will open the original in Mail.app.

You can also control the behaviour of double-clicking on the item in DT3. If “Double-click opens documents externally” is not selected (see image below), then double-clicking will open the email in DT3’s wrapper. If it is selected, then it will open the original email in Mail.app.

Note the keyboard shortcuts above are not affected by this preference selection.

Untitled

HTH!

Not sure. I think DEVONthink’s menu Open with > Mail simply opens the mail that’s stored inside DEVONthink’s database package. It does not open the original mail, i.e. the mail that were used for import into DEVONthink.

At least that’s what testing suggests as using that menu opens the mail, however it’s marked as unread in Mail.app and one can’t alter that read state.

So if one wants to open the actual mail that’s stored in Mail.app one has to use one of the two scripts, I think.

Hmmm…I’ve created a .gif animation from a screen recording of me selecting an email stored in DT3, then pressing CMD-SHIFT-o.

You can see the original mail in Mail.app (check the menu bar) open next to it.

Apologies for the tiny GIF. It’s a limitation of the software I am using for the conversion.

CMD-SHIFT-o.mov

I have noticed the read state too - it always is in “unread” but it does not reflect the email in Mail.app. In fact, you can change other metadata on the email.

Try this:

  1. Open up an email in DT3 using CMD-SHIFT-o.
  2. Then make sure you have the main email app window open somewhere and find the email that you have opened in DT3.
    You may notice that the email you opened in DT3 above appears read in the main Mail.app whereas unread in the window that popped up after CMD-SHIFT-o.
  3. Now in the window that just popped up after CMD-SHIFT-o, mouse over the “unread indicator” (ie the blue dot), you will notice an outline of a star appears.
  4. Click on the “star”, now look at the email in the main Mail.app window – it will be starred as well.

(The “star” is a quick way to designate a sender as a VIP.)

I think this shows me that what you are seeing is not the DT3 copy somehow co-opting mail.app to display it like you can a PDF with Preview, for instance.

I don’t know how it is done under the hood in DT3, but I suspect it uses the usual X-callback-URL.

As to the read state, I can only speculate that it is a bug,

Have you got more evidence that you think that Mail.app is actually displaying the contents of the .eml copied to DT3?

I confirm that Mail is displaying the contents of the stored .eml file
There is no url (backlink) stored for the original Mail Message
edit; see Apple Mail DEVONThink extension: Can I launch the original message from DT? - #15 by Luminary99_0

fwiw The backlink will fail if the original email has been purged

OK I stand corrected.

I dragged and dropped an email from Mail.app onto the desktop and opened the resulting .eml file.

It has the same features as opening one from DT3 - unread state, unable to delete, junk etc. The VIP function above probably just changes a flag in Contacts.app where Mail.app gets its ground truth from (cached in “recent recipients”),

In fact, that’s probably a good way to distinguish between email opened outside Mail.app and those from within.

For my usage in DT3, it does not bother me as the only reason I’d want to open a .eml in Mail.app is to reply or forward it, both which function properly.

Maybe what we should suggest to the DT3 code magicians is to have the x-callback-url placed in the “URL” metadata rather than the extracted mailto: (as is the current behaviour).

I suspect the current behaviour has been well thought through: to make it easy to send an email to the sender of an imported email.

However, there is replication as you can send an email to the sender by double clicking on the sender’s name in the imported email. (Although it seems to open the new mail window behind DT3).

This has actually been discussed on the forums.

PS: Not to be too pendantic, but it’s not an x-callback-url; it’s a URL scheme. A callback URL is a specific type of URL scheme and unsupported in DEVONthink.

Here’s is an interesting work-around.

The origin of the message that we have dragged or copied into Devonthink from Mail.app is actually embedded in the “URL” metadata. Here is an example of the metadata that is processed and placed there by DT3:

image

Now, the reply-to variable is actually the message ID. So if you delete everything up reply-to= (including the equal sign) and replace the text with message:,

image

now when you “Launch” it will open the actual email from Mail.app.

Launch will open the original message

It’s a work-around, but maybe it’s okay for the few where you want to get to the original message.

That’s exactly what both scripts do:

No need to do it manually.