How can I send a Email with attachment via Outlook on MacOS from the command line

49 Views Asked by At

I want to send an Excel workbook as a email attachment on on automated basis from the Command line of MacOS via Outlook, has to be via Outlook to get through all the required authentication.

I am already successfully creating the email with this command: /usr/bin/open -b com.microsoft.outlook 'mailto:[email protected]?subject=reports&body=Please find attached reports' but I cannot figure out how to pass an argument to attach a file

2

There are 2 best solutions below

0
Dmitry Streblechenko On

mailto protocols does not support attachments. You can only do to (the default mailto parameter), cc, bcc, subject, body. No attachments or HTML body.

0
Eugene Astafiev On

The mailto protocol opens a client's e-mail system and begins a new email message. The optional parameters can be one of the following strings:

  • subject - Text to appear in the subject line of the message.
  • body - Text to appear in the body of the message.
  • CC - Addresses to be included in the "cc" (carbon copy) section of the message.
  • BCC - Addresses to be included in the "bcc" (blind carbon copy) section of the message.

There is no way to specify any attachments.

For more information on the mailto protocol, see RFC2368: The mailto URL scheme