Forwarding Emails with Shortcuts

Hi – I am trying to create a shortcut where I can forward an email directly onto a named person. I do this several times a day, but have so far, other than using Siri, I’ve not been able to accomplish this using the shortcut. Would anyone be able to point me in the right direction? Thanks, Brian

Shortcuts doesn’t have direct mailbox access, and so can’t interact directly with received e-mail. The share sheet would be the way to get the mail into Shortcuts, but I don’t think the native Mail app offers that option.

I think you may be out of luck on the Shortcuts front for this.

1 Like

Hi - I checked out this issue on Apple Forums and found this AppleScript. However, when I tried to run it I received error messages. Could anyone help me to correct this? I’m not an AppleScript aficionado and so I’m not sure quite what I’m doing.

set myComment to "My comment: "
set theName to “Some name”
set theAddress to “Some email address”

set the clipboard tomyComment
tell application “Mail”
set theSelection to selection
set theForwardedMessage to forward (item 1 of theSelection) with opening window
tell theForwardedMessage
makenewto recipientat end of to recipientswith properties {name:theName, address:theAddress}
end tell
tell application “System Events” to keystroke “v” using {command down}
delay 1
end tell
end try

Thank you very much for this insight

*For info, if you place your code between sets of triple back ticks (```), it will format it as a code block and make it easier to read as it will retain indentation and for some languages, apply syntax highlighting.

For example.

set myComment to "My comment: "
set theName to "Some name"
set theAddress to "Some email address"

Can you share what the error messages you are seeing are? Not everyone would necessarily get the same ones as it would depend upon the cause and the effect.

One guess might be that if the code you pasted above is exactly what you have tried to run, some of those double quotes don’t appear to be standard double quotes, but instead smart double quotes. They are not treated the same in AppleScript.

This can actually be seen if I copy the same lines verbatim from above and format them in a code block.

set myComment to "My comment: "
set theName to “Some name”
set theAddress to “Some email address”

Note how only the first line has the syntax highlighting this time. That’s because only that line is using non-smart double quotes.

Really appreciate your help on this :slight_smile:

1 Like

On the second photograph you can see the blue highlight

That suggests it is the double smart quote issue I set out above then. Try replacing the smart quotes with standard ones.

Hi - so I went through and changed all the quotes to regular quotes but I have this further error message.


Are you able to suggest any remedial steps? Thanks again, Brian

Yes. Shouldn’t tomyComment be to myComment?

AppleScript is supposed to be grammatically quite similar to English - you should in most cases be able to read a line of code aloud and it make sense.

I’m getting into such a muddle with this coding. I don’t want to keep troubling you. Is there someone you know who I could speak to to cast their eye over this and sort it out? Everytime I seem to run out there is yet another error.

I’m pretty sure that one of the purposes of this forum is to help with those sorts of issues. You just need to post what they are and the details of what you see. Then there are potentially well over 2K members who might be able to pitch in and help with your latest challenge.

1 Like

Now I’m confused…

… This post is tagged “iOS” and indeed I see mention of Shortcuts. But then I see some AppleScript.

Can someone help me understand?

That’s an example of executing commands via SSH. I don’t this it is quite what Brian was doing above. I think it’s just confused tagging of the post as Shortcuts.