Drag and Drop for Apple Mail

In Obsidian, I can just drag and drop an email from apple mail to the text field. It creates a link like subject.

If I drop it in obsidian and copy the link to logseq it works. However would be nice if I could drag and drop it directly to logseq to transform mails into todos and keep my inbox empty :slight_smile:

I have a workaround now. I created a apple workflow that consists of the following:

This s the apple script:

on run {input, parameters}
	tell application "Mail" to set rawSource to source of (item 1 of (input as list))
	return rawSource
end run

and this is the python script:

import re
import sys

def extract_message_id(email_text):
    match = re.search(r"Message-ID:\s*<(.+?)>", email_text)
    if match:
        return match.group(1)
    return None

def extract_subject(email_text):
    match = re.search(r"Subject:\s*(.+)", email_text)
    if match:
        return match.group(1)
    return None

input = sys.stdin.read()
message_id = extract_message_id(input)
subject = extract_subject(input)
print(f"[{subject}](message:%3C{message_id}%3E)")%

Then I use the tool better touch tool, which I run anyways to execute the workflow when I press CMD+SHIFT+C in the mail program.

Nevertheless for an easy workflow drag and drop would be preferred :slight_smile:

1 Like