Article ID: 197920 - View products that this article applies to.
This article was previously published under Q197920
This is a simple VBScript example of how to automate sending mail through Microsoft Outlook.
This example will work in either an Active Server Pages (ASP) page or in Windows Script Host (WSH), as long as there is a valid Outlook User Profile available on the system. This User Profile appears in the from field of the mails generated. It would be possible to set up a Profile that is used solely for sending automated messages.
Use the following steps with WSH:
Save the code listed below into a file with a .vbs extension. To test, double-click on the file in Windows Explorer.
If you are using Windows 95, you need to install Wsh.exe from the following Web site to enable Windows Script Host:
http://msdn2.microsoft.com/en-us/library/ms950396.aspxUse the following steps with ASP:
Assuming you are saving it on a Web server with Active Server Page Extensions installed, you can just include the code directly into an ASP page, or save it in a file that you include into any ASP page that needs mailing capabilities.
Use the following for both methods:
Don't forget to change the recipient and the logon information. The logon has to be a valid Outlook user profile.
NOTE: If you intend to run these scripts from the context of a service, look at article Q177851 in the REFERENCES section below.
(http://support.microsoft.com/kb/191430/EN-US/ )Run a WSH file from NT Scheduler
177851For more information about the technologies discussed here, please refer to the article "Getting Started with ASP Messaging" in the MSDN Online:
(http://support.microsoft.com/kb/177851/EN-US/ )Build a VB/Messaging Application to Run from a Service
Article ID: 197920 - Last Review: August 8, 2007 - Revision: 3.6