Save email as task

Hey all - I’m trying to eliminate some of the other apps I use and consolidate everything into obsidian.

Right now I use Microsoft to-do because when you flag an email in outlook, it can automatically create a task for it in to-do…

Is there any way a shortcut could be set up where you could “select” and email and it create a task in obsidian?

Can’t figure out how to get the email selection part in, ideally I want the task to have a link back to the email.


I’ve absolutely no experience with Outlook on macOS, I’m afraid, so I can’t be much help. No idea if it brings any Shortcuts actions to the table…

I actually can use the mail app too, however I cant figure out in the shortcut how to actually choose the mailbox (I have multiple accounts set up with it) I want it to pull the emails from… haven’t gotten to far yet but this is what I have so far…

Ideally it would show the list of all the emails, can choose the email I was to create a task for, it would then prompt for the due date, and then create the task on my daily note with the due date, and archive the email

If you’re fine with working in Apple’s, I can do you one better. Here’s an example workflow which extracts sender, subject and the mail’s internal link for use in Shortcuts:

How-to: Get selected message from (22.5 KB)

The workflow uses Applescript for extracting the info, then turns its result into a dictionary (using the built-in Get Dictionary from Input action), which allows you to use the dictionaries mailSender, mailSubject and mailLink keys further down the line – for example when creating a new Obsidian note or task.

Hope this helps!

@czottmann and @ethanopp I adapted the AppleScript for Outlook. But this only works when the Outlook App is running in the “legacy mode”. Because Outlook covers mail, contacts, task the Outlook AppleScript function library is a little bit more complex that the one of Apple Mail (s. screenshot below), but it’s hard to find good examples and I’m not an Apple Script expert, so I can’t give more advise :frowning:.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

on run
	tell application "Microsoft Outlook"
		if not it is running then activate
		set selectedMessages to current messages
		if selectedMessages is not {} then
			set msg to item 1 of selectedMessages
		end if
		tell msg
			set mailSender to its sender
			set mailSubject to its subject
			set messageId to id of item 1 of selectedMessages
			set uri to "outlook://" & messageId
			return {mailSender:mailSender, mailSubject:mailSubject, mailLink:uri}
		end tell
	end tell
end run

These are both great but how do they work when you have more than one account set up?

For example in my mail app and outlook app, I have my company email and my personal Gmail both connected, how do I just parse my company emails?

II run both scripts on Outlook and Mail and both work with multiple accounts. It just takes the selected item and prints some information. Nothing more, nothing less. BTW: The URI part of the Outlook script is useless. It needs some more research.

I added two scripts here that list all accounts by name, which might be useful if you only want to look into your private gmail account. I think you can do a lot with AppleScript in both mail applications, but from my non-expert perspective, it might not be easy.

Regards, Leif

tell application "Microsoft Outlook"
	set theAccounts to get imap accounts
	set ExchangeAccounts to get exchange accounts
	set theAccounts to theAccounts & ExchangeAccounts
	set accountInfo to {}
	repeat with theAccount in theAccounts
		set end of accountInfo to "Name: " & name of theAccount
		set end of accountInfo to "Username: " & user name of theAccount
	end repeat
	return accountInfo
end tell
tell application  "Mail"
	set theAccounts to get accounts
	set AccountInfo to {}
	repeat with theAccount in theAccounts
		set theAccount to {name of theAccount & "---" & user name of theAccount & "---" & server name of theAccount & "---" & port of theAccount}
		set end of AccountInfo to theAccount
	end repeat
	return AccountInfo
end tell

For example in my mail app and outlook app, I have my company email and my personal Gmail both connected, how do I just parse my company emails?

The workflow uses the selected mail, or, if there is more than one selected mail, the first of those. It doesn’t care about which account the mail belongs to, and the link it returns should make retrieve the mail from any account it knows.

Thanks got it working!

Not a fan of the outlook legacy mode but hopefully if AppleScript comes to the new outlook on Mac I can switch over…for now mail app works