How to Create a File Defining the Constants for Use with CDONTS.NewMailID: Q218607
|
The Windows NT Option Pack (NTOP) exposed Collaboration Data Objects for Windows NT Server (CDONTS) gives Active Server Pages (ASP) an easier method for sending mail. This article describes how to create a file that defines the constants for use with the CDONTS.NewMail object.
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
To include the code in an ASP page, use the Server-Side Includes (SSI) syntax to reference the path to the file:
<!--#include virtual="/cdovbs.inc"-->
To use this page, copy the following ASP code and save it as "Cdovbs.inc" (without the quotation marks) in the root of a Web site:
<%
'--------------------------------------------------------------------
' Microsoft CDONTS.NewMail
'
' (c) 1999 Microsoft Corporation. All Rights Reserved.
'
' More NT Option Pack Documentation:
' http://<ServerName>/iishelp/iis/htm/asp/amsm0qzj.htm
'
' CDONTS.NewMail constants include file for VBScript
'
'--------------------------------------------------------------------
'---- BodyFormat Property ----
Const CdoBodyFormatHTML = 0 ' The Body property is to include Hypertext Markup Language (HTML).
Const CdoBodyFormatText = 1 ' The Body property is to be exclusively in plain text (default value).
'---- MailFormat Property ----
Const CdoMailFormatMime = 0 ' The NewMail object is to be in MIME format.
Const CdoMailFormatText = 1 ' The NewMail object is to be in uninterrupted plain text (default value).
'---- Importance Property ----
Const CdoLow = 0 ' Low importance
Const CdoNormal = 1 ' Normal importance (default)
Const CdoHigh = 2 ' High importance
'---- AttachFile and AttachURL Methods ----
Const CdoEncodingUUencode = 0 ' The attachment is to be in UUEncode format (default).
Const CdoEncodingBase64 = 1 ' The attachment is to be in base 64 format.
%>
The following is an ASP example of a page using the code from above:
<%@LANGUAGE="VBSCRIPT"%>
<%
Option Explicit
Dim objNewMail
%>
<!--#include virtual="/cdovbs.inc"-->
<%
Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = "someone@microsoft.com"
objNewMail.To = "someone@microsoft.com"
objNewMail.Subject = "This is a test message"
objNewMail.Body = "This is a test message"
objNewMail.BodyFormat = CdoBodyFormatText
objNewMail.MailFormat = CdoMailFormatText
objNewMail.Importance = CdoNormal
objNewMail.Send
Set objNewMail = Nothing
%>
<html>
<head><title>CDONTS.NewMail Test</title></head>
<body>
Your mail has been sent!
</body>
</html>
For more information on Microsoft Scripting Technologies, please see the information at the following URL:
http://msdn.microsoft.com/scripting/
Additional query words:
Keywords :
Version : winnt:4.0,5.0
Platform : winnt
Issue type : kbhowto
Last Reviewed: March 18, 1999