Tip #19: How to Create New Outlook E-mail from the Command Line

Written by:  • Edited by: Linda Richter
Updated Aug 5, 2010
• Related Guides: Microsoft | Outlook 2007 | Command Prompt

Sometimes it is helpful to launch a new e-mail form from the run or command line. We will explain how to do so and the options.

Using the Command Line to Creating Emails, Appointments, and Tasks in Outlook

There are numerous Outlook 2007 command line switches that can be executed from the Run line or a command prompt. One of these switches creates a new e-mail message.

The Outlook 2007 executable is outlook.exe. It is found in %programfiles%\Microsoft Office\Office12\. You can call outlook.exe from the command line with the full path (or add the location to the Path environment variable). The command line switch for creating a new object is /c. You can then identify the type of object, or the messageclass, to create with a different parameter for each Outlook form. For example:

  • ipm.activity creates a Journal entry
  • ipm.appointment creates an appointment
  • ipm.contact creates a contact
  • ipm.note creates an e-mail message
  • ipm.stickynote creates a note
  • ipm.task creates a task

Example Command to Send Email with Attachment

Example Command to Send Email
click to enlarge
When using the command line parameter /c you can also assign a recipient address to the new e-mail form using the /m switch. If you needed to add an attachment, that can also be accomplished with a command line request. The /a switch with the file path will attach the specified file to the new e-mail form. So, as an example, to create a new e-mail form addressed to someone@gmail.com with an attachment logfile.txt, you would run from the command line:

c:\>"c:\program files\microsoft office\office12\outlook.exe" /c ipm.note /m someone@gmail.com /a "c:\logs\logfile.txt"

This is shown in the image to the left. The image on the right shows the output for this command. The path to outlook.exe is in quotes because there are spaces in the path.

Outlook Email With Attachment Opened from the Command Line
click to enlarge
You can create a desktop shortcut to launch this email message as well. Right click on the desktop and select New Shortcut and enter the same path used from the command line. Now double-clicking the shortcut will create the new message. I have used this basic process for a recurring message that manually sent a text file to a recipient. The user did not have to create and address the message every time.

There are other methods of creating new emails without using the Outlook user interface. To expand on this tip, check out Microsoft KB article 287573.


Comments

Showing all 11 comments
 
Catbass Feb 1, 2012 5:43 PM
RE: Tip #19: How to Create New Outlook E-mail from the Command Line
try add more attachments but only allow one attachment. Is there a way to add more attachment from the cmd line?
lumenlux Mar 12, 2011 5:50 AM
/m and /a
seems that /a and /m are incompatible!
How to do to use both?
gunn Aug 24, 2010 7:21 PM
how to go ahead and actually send it?
creating the email and getting it ready to send it is fine. works fine. But how can i go ahead and actually send the message on its way from the command line itself?
Anonymous Aug 5, 2010 9:32 AM
Zzz
note: it's ipm.note, not ipmnote
Swapnil May 13, 2010 2:23 AM
Can we add a Subject & Message part?
Hi All,
Can we populated a subject field and message part with the above options? Also, I would like to know if there is anything like outlook.exe /? or outlook.exe -h etc to get help on list of command-line commands available.
Thanks in advance.
almighty May 5, 2010 9:00 AM
correction
it shud be ipm.note
Verdun1 Dec 15, 2009 10:54 AM
FIX Tip #19
Oops. They left out the period.

"c:\program files\microsoft office\office12\outlook.exe" /c ipm.note /m someone@gmail.com /a "c:\logs\logfile.txt"
wafa Dec 7, 2009 1:11 PM
RE: Tip #19: How to Create New Outlook E-mail from the Command Line
please write this command line again it didnt work properly :)
wafa Dec 7, 2009 1:10 PM
RE: Tip #19: How to Create New Outlook E-mail from the Command Line
this command line dosnt work please write again
Pravin Singh Rathor Nov 11, 2009 9:54 AM
send the email through command line
C:\>"c:\program files\microsoft office\office12\outlook.exe" /c ipmnote /m p.rathor@sbi.co.in /a "c:\vvr\00568.xls"

the above is the command I type but it gives error "Cannot start MicrosoftOffice Outlook. The command line argument is not valid. Verify the switch you are using" this comes only when I join the /a "C:\filename" else works individually
hallie moore Aug 6, 2009 6:04 PM
email
I need to establish regular email functions.
 
blog comments powered by Disqus
Email to a friend