macOS calendar: one way to work around broken email linking

Take an email with a date/time indication and next to that click on the Data Detectors widget to generate a calendar entry. Then switch over to Calendar and enjoy that freshly generated calendar entry. Note how in its Notes/URL section it displays a little blue link “Show in Mail…” that when clicked will open the originating email. Beautiful.

Now go to calendar and create a random new entry. Then take that email and drag it to this new entry’s Notes/URL section. Save the event. Open it again. Inspecting it now shows some kind of attempt at creating a link to that email, but the link is garbled and doesn’t actually work. It doesn’t even display like it did if you followed the first method.

This didn’t use to be that way. This used to work, no matter if you went the Data Detectors route or the manual drag 'n drop route. And it’s relevant because sometimes Data Detectors don’t manage to detect an event date/time you’re trying to link to. If the drag 'n drop method could be made to work again, that wouldn’t be a problem.

I have managed to find one somewhat clunky workaround though. If instead of trying to drag the email onto an existing entry, you just drag it onto Calendar, it will create an entry that properly links to the original email. You then have to manually adjust the time and duration, plus probably the item heading (default it will just take the entire email subject line). It’s a bit clunky, but at least it works.

The only exception would be if you already happen to have a calendar entry you want to add an email link to. Haven’t yet figured out a fix for that besides hoping Apple will eventually fix this annoying little Calendar bug (yes, it’s been reported).

1 Like

You could use AppleScript to create the message: URL and put it on the clipboard for easy pasting into a calendar event. You want the message id property of a message. That id is unique and if put after message: it creates the URL that opens an email in Mail (or your default email handler). I believe the basic script you need to get the message id is as follows, but I’ve not tested it:

tell application "Mail"
  set theSelectedMessages to selection
  set the selected_message to item 1 of the theSelectedMessages
  set message_id to the message id of the selected_message
end tell

Nice idea. The AppleScript appears to work. However, Mail claims it cannot open that URL.

error
[I deliberately chopped off the actual URL]

I forgot to say that you need to enclose the message id in encoded angle brackets. So when constructing the URL it should be:

set message_URL to "message:%3C" & message_id & "%3E"

I believe that should work (but again, haven’t tested).