Microsoft KB Archive/218607

= HOW TO: Create a File That Defines the Constants for Use with CDONTS.NewMail =

Article ID: 218607

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Internet Information Services 5.0
 * Microsoft Internet Information Server 4.0

-



This article was previously published under Q218607



We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

http://www.microsoft.com/technet/security/prodtech/IIS.mspx



IN THIS TASK
SUMMARY
 * How to Include the Code in ASP

REFERENCES



SUMMARY
This article explains how to take advantage of Collaboration Data Objects (CDO). The NT Option Pack (NTOP) exposed CDO for Windows NT Server (CDONTS) provides the Active Server Pages (ASP) page 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.

back to the top

How to Include the Code in ASP
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: To use this page, copy the following ASP code, and then save it as Cdovbs.inc in the root directory of a Web site: <% ' ' Microsoft CDONTS.NewMail ' ' (c) 1999 Microsoft Corporation. All Rights Reserved. ' ' More NT Option Pack Documentation: '  http:///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 a sample ASP page that uses the preceding code: <%@LANGUAGE="VBSCRIPT"%> <%   Option Explicit Dim objNewMail %>

<%   Set objNewMail = Server.CreateObject("CDONTS.NewMail") objNewMail.From = "someone@example.com" objNewMail.To = "someone@example.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 %> CDONTS.NewMail Test Your mail has been sent!

back to the top

