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 professionals 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 a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:
Microsoft Certified Partners - https://partner.microsoft.com/global/30000104
Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
How to Use a Desktop Shortcut
There are two methods to create a desktop shortcut for pre-addressed mail. Use the first method if you send the e-mail through the default mail program. Use the second method if Outlook is not your default e-mail program.
- Right-click a blank place on the desktop, point to New, and then click Shortcut.
- In the Command Line box, type: <mailto:> followed by the full e-mail address of the person you want to send the e-mail to.
- Type a name for your new shortcut.
- Double-click the shortcut to launch a blank e-mail message. As Outlook is your default e-mail program Outlook opens and processes the message.
To create a shortcut on your Windows desktop that automatically creates anew pre-addressed e-mail message, if Outlook is not the default e-mail program, follow these steps:
- Right-click a blank area of your Windows desktop, point to New, and then click Shortcut.
- In the Command Line box, type the following
"C:\Program Files\Microsoft Office\Office\Outlook.exe" /c ipm.note /m <full e-mail name> where <full e-mail name> is the complete e-mail address of the recipient (For example, JohnDoe@msn.com.)
NOTE: You may have to modify the path if you did not install Outlook to the default setup location.
- Type a name for the shortcut, for example, Mail to John Doe.
- Click Finish.
If you want to use a custom form in your desktop shortcut, use its message class rather than IPM.Note
. For example, if the custom form you want to use has a display name of "MyForm," (without quotation marks) then the message class should be IPM.Note.MyForm
, and the following is the command used to create a message using the custom form:
"C:\Program Files\Microsoft Office\Office\Outlook.exe" /c ipm.note.myform /m <full e-mail name>
How to Use the Microsoft Office Shortcut Bar
To add a button to the Office Shortcut Bar to automatically create anew pre-addressed e-mail message, follow these steps:
- Right-click your Office Shortcut Bar, and then click Customize.
- 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.
How to Add the Command Line Switch to the Outlook Button
- Right-click the Outlook button on the Office Shortcut Bar, and then click Properties.
- Click the Shortcut tab.
- Click to position the insertion point at the end of the text in the Target box, type a space, and then type the following
/ c ipm.note /m <full e-mail name>where <full e-mail name> is the complete e-mail address of therecipient (For example, JohnDoe@msn.com).
- Click OK.
button on the Office Shortcut Bar starts Outlook if it is not already running, and creates a new e-mail message to JohnDoe@msn.com.
How to Use the Shell Command
To automatically create a new pre-addressed Outlook e-mail message by usingthe Shell
command, follow these steps:
- Start Microsoft Word.
- On the Tools menu, point to Macro, and then click Macros.
- In the Macro Name box, type SendMail, and then click Create.
- 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 <full e-mail name>" where <full e-mail name> is the complete e-mail address of the recipient (For example, JohnDoe@msn.com.)
- On the File menu, click Close and Return to Microsoft Word.
- On the Tools menu, point to Macro, and then click Macros.
- In the Macro Name box, click to select SendMail, and then click Run. The SendMail macro creates a new e-mail message addressed to the recipient that you chose in step 4.
If Outlook is running, the e-mail message opens quickly. If Outlook is notrunning, there is a delay while the Windows Messaging System starts in thebackground.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.
Single Command-Line String for a Message with Subject and BodyNOTE
: The procedures that are outlined in this section assume that the you are familiar with creating the type of objects listed in the implementation list.
In order to create a preformatted and pre-addressed e-mail message, it isnecessary to build a command-line string with the following parameters:
mailto:<to email>?cc=<cc email>&bcc=<bcc
mail>&subject=<subject text>&body=<body text>
Where the following variable definitions apply:
Variable Field Entry -------------------------------------------------------------- <to e-mail> e-mail address to appear in the To field <cc mail> e-mail address to appear in the CC field <bcc mail> e-mail address to appear in the BCC field <subject> text to appear in the Subject field <body text> text to appear in the Body of the message
Note the position of the question mark (?) and ampersand (&) characters in the command-line syntax.
In addition to the field designations, you must use ASCII hexadecimalequivalents as variables for punctuation characters. The followingvariables are used to represent commonly used characters:
Space ( ) %20
Comma (,) %2C
Question Mark (?) %3F
Period (.) %2E
Exclamation Point (!) %21
Colon (:) %3A
Semicolon (;) %3B
The following is an example of a command-line for the Subject and Body text using these variables:
This command-line yields the following information:
Subject: Hello World!
Body : How are you, John?
Uses of the Command-Line String
This command-line string may be used in the following implementations:
- In the Open box of the Run command line.
- In the Properties of a desktop shortcut
- In the Address Bar of Internet Explorer 4.0.
- In the body of an Outlook Express e-mail message.
- In the Hypertext Markup Language (HTML) code of a Web page.
For more information about automating Outlook, please see the followingarticles in the Microsoft Knowledge Base:
: OL2000: How to Automate Outlook from Another Program232309
: OL2000: How to Set a Form's From Field Using VBScript146636
: OL2000: Questions About Custom Forms and OutlookSolutions
For more information about Outlook command-line switches, please see thefollowing article in the Microsoft Knowledge Base:
: OL2000: Additional Command-Line Switches
For more information about controlling the starting of Outlook, clickMicrosoft Outlook Help on the Help menu, type "Control what happens whenyou start Outlook " in the Office Assistant or the Answer Wizard, andthen click Search to view the topic.