Sending a Web Page by SMTP Mail Using CDOSYS
Topic Last Modified: 2006-06-11
Example
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
%>