Starting Outlook and having an email pre-populated from command line

VonC's solution works, but as stated in the comments by skbergam it doesn't allow for attachments.

If, like me, that's a biggie then the following WSH code does it.

Set olApp = CreateObject("Outlook.Application")
Set olMsg = olApp.CreateItem(0)

With olMsg
  .To = "[email protected]"
  '.CC = "[email protected]"
  '.BCC = "[email protected]"
  .Subject = "Subject"
  .Body = "Body"
  .Attachments.Add "C:\path\to\attachment\test.txt" 

  .Display
End With

I've tried it with Outlook2003


You can attach files AND pre-fill in the To/Body if you simply place " " quotes around the command after the /m

Example:

outlook.exe /c ipm.note /m "[email protected]&subject=test%20subject&body=test%20body" /a test.txt

Open a new mail message (ipm.note is the message class for emails)

outlook.exe /c ipm.note

Open a new mail message and populate sender:

outlook.exe /c ipm.note /m [email protected]

Open a new mail message with attachment:

 outlook.exe /c ipm.note /a filename

Combination: (First one below didn't work in Office 2016, second did)

 outlook.exe /c ipm.note /m [email protected]&subject=test%20subject&body=test%20body
 outlook.exe /c ipm.note /m "[email protected]&subject=test%20subject&body=test%20body"

The %20 has to be used to produce a blank space.

  • More details at Command Line for Creating a Pre-Addressed E-mail Message
  • Command-line switches can be found here

This works for instance with a classic Outlook 2016 (build 16.0.4849.1000).

But, as Snozzlebert notes in the comments, for a Outlook 365 Version 2001 (Build 12430.20184) the syntax would be:

outlook.exe /c ipm.note /m "[email protected]?subject=test"

the culprit was the & after the email-address - replacing it with ? solved the problem.
It seems that Microsoft changed the syntax to the HTML mailto syntax.