Outlook Developer Home
Outlook Programmer's Library
 
Outlook Technologies
Outlook Forms
Languages
Samples
Other Technologies

 

 

Using Microsoft Outlook to Schedule Report Transmissions

A newsgroup posting asked how Outlook might be used to send the same file to the same group of people every day at the same time. Assuming you have a scheduler, this turns out to be easy to do by combining a form with a tiny bit of VBScript with one of the Outlook command line switches.

Setup | Usage | Notes | Limitations | Other Tools | More Information

Setup

Step 1: Create an ordinary message with the recipients, subject and any cover note text. Use Tools | Check Names to resolve the addresses. Use File | Save to save a copy of this as a draft somewhere in your Outlook folders, in case you want to modify it later. You could also use File | Save As to save it as an Outlook template .oft file. Be sure you save it before you add the code in the next step!

Step 2: Choose Tools | Forms | Design a Form (Tools | Design Outlook Form in Outlook 97), then Form | View Code. Type this bit of code into the Script Editor:

This will cause this item to be sent as soon as it's created. Choose File | Close to close the Script Editor.

Step 3: On the (Properties) tab of the form, clear the box for Send form definition with item. This is necessary to keep the item from being sent again when the recipient opens it, if it's an Outlook recipient.

Step 4: Choose File | Publish Form As. Give it a name, such as Network Status Report. This will also cause it to have a Message Class of IPM.Note.NetworkStatusReport (or whatever you named it). Publish it in Personal Forms.

Step 5: Create a shortcut to Outlook.exe using the /c and /a command switches, which are documented in the "Control what happens when you start Outlook" help topic:

<path>\Outlook.exe /c "IPM.Note.NetworkStatusReport" /a <path>\<filename>

where <path>\<filename> is the particular attachment you want to send.

Back to Top

Usage

When you run the shortcut created in Step 5, Outlook creates a message with the recipients, subject, cover note and attachment, then sends it into the Outbox. Creating it first as a shortcut gives you a way of testing it. Once it works the way you like, you can use the command line with any scheduler. Naturally, you'll need to have Outlook running for the item to actually be delivered.

Back to Top

Notes

Another method would be to skip Outlook and use the Command Line Mail Sender from the Microsoft Exchange 5.0 Resource Kit. The advantage to the Outlook method is that you can add a cover note and formatted text.

If you create a form with this code and want to edit it later, hold down the Shift key as you open the form. That will prevent the code from running.

Back to Top

Limitations

This form was designed before the Outlook Email Security Update imposed prompts on the Send method that prevent the message from sending automatically. Outlook 2000 SP-2 and Outlook 2002 users will get prompts; you may want to rewrite the code to use Redemption objects. Outlook 2003 users will not get a prompt on a published form.
Back to Top

Other Tools

Email Scheduler Schedule messages to be sent at specific date/times or intervals by setting up a task for each message.
File Send Automatically Addin for Outlook 2000 or later that monitors a particular file for changes and automatically sends an update to a list of recipients with the latest file attached.
MailRules Integrates with Outlook to apply rules for inbound and outbound e-mail. Rules can be scheduled and can update data, route mail, run applications, and perform other functions. Can also schedule report deliveries.
Schedule Recurring Email Send messages at regular intervals, similar to the scheduling for recurring appointments. Send an attachment or even the contents of an entire folder. Triggers Outlook security prompts only when creating the messages, not when sending them. Outlook 2000 or later.
SendLater Send messages at the date/time of your choice either once or recurring. Can transmit the latest version of a file. Outlook needs to be running when the time for sending the message arrives. Outlook 2000 or later
Back to Top

More Information

   
2002-7 TurtleFlock, LLC
All right reserved.
About OutlookCode.com

Send comments to webmaster@outlookcode.com

Designed and Implemented by TerraLink USA 

FrontPage Integration
by RobsonDesignWorks

 
 
get Sue's code | forums | share your own code | registration