Share via


Sending a Web Page by SMTP Mail Using CDOSYS

Sending a Web Page by SMTP Mail Using CDOSYS

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

VBScript

' This script uses the CreateMHTMLBody method of the iMsg object to send a Web page
' to another SMTP recipient using the CDOSYS library.


<%@ Language=VBScript %>

<%

' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library

Dim iMsg
Dim iConf
Dim Flds

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

' Set the configuration fields.
Set Flds = iConf.Fields

' Set the proxy server to be used.
' TODO: Set "someproxy:80" to the name of your proxy server.
Flds("https://schemas.microsoft.com/cdo/configuration/urlproxyserver") = "someproxy:80"

' Set if this is a local server.
Flds("https://schemas.microsoft.com/cdo/configuration/urlproxybypass") = "<local>"

' Set the option to retrieve the latest content directly from the server.
Flds("https://schemas.microsoft.com/cdo/configuration/urlgetlatestversion") = True
Flds.Update

' Set the message properties.
With iMsg

Set .Configuration = iConf
' Create the MIME representation of the Web page in the message.
' TODO: Change the To and From fields to valid e-mail addresses.
.CreateMHTMLBody "http://www.example.com"
.To = "user1@example.com"
.From = "user2@example.com"
.Subject = "Sample MHTML message..."
.Send
End With

%>


Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.