OL97: Command Line for Sending a Pre-addressed E-mail Message

Last reviewed: January 19, 1998
Article ID: Q172958
The information in this article applies to:
  • Microsoft Outlook 97

SUMMARY

This article describes how to use command line switches to create a new Microsoft Outlook 97 e-mail message that is pre-addressed (with the To field filled in automatically). You can do this in the following ways:

  • Using a desktop shortcut.
  • Using a Microsoft Office 97 Shortcut Bar button.
  • Using the Shell Command.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/

Using a Desktop Shortcut

To create a Shortcut on the Windows desktop that automatically creates a new pre-addressed e-mail message, follow these steps:

  1. Using the right mouse button, right-click a blank area of the Windows desktop.

  2. On the shortcut menu, point to New, and then click Shortcut.

  3. In the Command Line box, type the following:

    "C:\Program Files\Microsoft Office\Office\Outlook.exe" /c ipm.note /m <full e-mail name such as, johnDoe@msn.com>

    NOTE: You may have to modify the path if you did not install Outlook to the default setup location.

  4. Type a name for the shortcut, for example, "Mail to John Doe."

  5. Click Finish.

Using a Microsoft Office Shortcut Bar Button

To add a button to the Office Shortcut Bar that automatically creates a new pre-addressed e-mail message, follow these steps:

  1. Click the Control button on the Office Shortcut Bar and then click Customize.

  2. On the Buttons tab, click to select the Microsoft Outlook button, and then click OK. The Office Shortcut Bar should now contain an Outlook button.

  3. To add the command line switch to the Outlook button, follow these steps:

        a. Right-click the Microsoft Outlook button on the Office Shortcut Bar,
           and then click Properties on the shortcut menu.
    

        b. Click the Shortcut tab.
    

        c. Click to position the insertion point at the end of the text in the
           Target box, type a space, and then type the following sample
           command line:
    

              / c ipm.note /m johndoe@man.com
    
    

  4. Click OK.

The Outlook button on the Office Shortcut Bar will start Outlook if it is not already running, and create a new e-mail message to johndoe@msn.com.

Using the Shell Command

To automatically create a new pre-addressed Outlook e-mail message using the Shell command, follow these steps:

  1. Start Word.

  2. On the Tools menu, point to Macro, and then click Macros.

  3. In the Macro Name box type SendMail, and then click Create.

  4. Type the following sample code in the Visual Basic for Applications editor:

    Shell "C:\Program Files\Microsoft Office\Office\Outlook.exe /c ipm.note /m JohnDoe@msn.com"

  5. On the File menu, click "Close and Return to Microsoft Word."

  6. On the Tools menu in Word, point to Macro, and then click Macros.

  7. In the Macro Name list, click to select SendMail, and then click Run. The SendMail macro should create a new e-mail message addressed to JohnDoe@msn.com.

If Outlook is running, the e-mail message opens quickly. If Outlook is not running, there is a delay while the Windows Messaging System starts in the background.

NOTE: Using the Shell command is very restrictive. You can better automate the contents of a new e-mail message with Visual Basic for Applications or VBScript.

REFERENCES

For more information about automating Outlook, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q168095
   TITLE     : OL97: How to Automate Outlook from Another Program

   ARTICLE-ID: Q168022
   TITLE     : OL97: How to Set a Form's From Field Using VBScript

   ARTICLE-ID: Q170783
   TITLE     : OL97: Q&A: Questions about Customizing or Programming
               Outlook

For more information about Outlook command line switches, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q156982
   TITLE     : OL97: Additional Command-Line Switches for Microsoft Outlook

Or, click the Office Assistant, type "control starting Outlook," click Search, and then click to view "Control what happens when you start Outlook."

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If <Product> Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q120802
   TITLE     : Office: How to Add/Remove a Single Office
               Program or Component


Additional query words: parameter parameters argument arguments
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 19, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.