1

I am trying to start composing a new message via mailto on OS X. I have set my default email client to be Outlook, so I can open up Outlook with a preconfigured message like so:

open 'mailto:SomeEmail@example.com?subject=hey&body=how are you doing'

but I want to also be able to use the mailto link to add an attachment to the preconfigured message. I have tried the following:

open 'mailto:SomeEmail@example.com?subject=hey&body=how are you doing&attachment=/Users/myName/Desktop/testFile.rtf'

but when Outlook opens, there is no attachment. I have read that whether or not attachments are allowed with mailto links depends on the client. Does anyone know if Outlook 2011 allows for this type of attachment?

Adam Johns
  • 35,397
  • 25
  • 123
  • 176

1 Answers1

4

Specifying attachments is not part of the IETF mailto: URI scheme, though individual clients may support it in one way or another.

I'm not sure if this MSDN document applies to Outlook 2011 (OSX), but if it does, then what you are trying to do is probably not possible with .

Alternatively, I assume that since you are using the open command at the command-line, then you will be open to other command-line/shell-script methods of achieving this. One such way is to redirect an in a here-document to osascript:

$ osascript <<EOF
> tell application "Microsoft Outlook"
>     set myMsg to make new outgoing message with properties {subject:"hey", content:"how are you doing"}
>     make new recipient at myMsg with properties {email address:{address:"SomeEmail@example.com"}}
>     make new attachment at myMsg with properties {file:"/Users/myName/Desktop/testFile.rtf"}
>     open myMsg
> end tell
> EOF
$ 
Community
  • 1
  • 1
Digital Trauma
  • 15,475
  • 3
  • 51
  • 83