Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending content of webpage (url) as HTML email

Status
Not open for further replies.

utilman

IS-IT--Management
Dec 25, 2002
35
NL
Does someone have a code that sends the content of a certain webpage/url as a html email automatically? I have a script that sends an attachment automatically, but I cannot figure out how to send any html content of a certain url.
 
thx tsuji.. made the following code:

Code:
Dim oName, ODomain, oMyIP, oTo

' Get the computer name
Set WshNetwork = CreateObject("WScript.Network")
oName = WshNetwork.ComputerName

' Set the company specific information

' Company Internet Domain Name
ODomain = "my.domain"
' Set the SMTP server IP
oMyIP = "10.0.0.0" 
' Where do you want the message to be delivered
oTo = "my@email.com"


' Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing",[/URL] _
cdoSendUsingPort = 2, _
cdoSMTPServer = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver"[/URL]

'// Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

'// SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort

'// Set the SMTP server address here.
.Item(cdoSMTPServer) = oMyIP
.Update
End With

'// Set the message properties.
With iMsg
Set .Configuration = iConf
.To = oTo
.From = oName & "@" & oDomain
.Subject = "Val Thorens"
'.TextBody = "Server " & oName & " at company " & ODomain & " was restarted " & now
End With

'// Download Webpage to file.
dim message, conf, stream
set message = CreateObject("CDO.Message")
set conf = CreateObject("CDO.Configuration")
set message.Configuration = conf
message.CreateMHTMLBody "[URL unfurl="true"]http://www.skifrance.fr/index.cfm?fuseaction=bn.detail&langue=a&IDS=730052"[/URL]
set stream = message.GetStream()
stream.SaveToFile "C:\valthorens.mht"

'// An attachment can be included.
iMsg.AddAttachment "C:\valthorens.mht"

'Send the message.
iMsg.Send 

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("C:\valthorens.mht"), DeleteReadOnly

Set WshNetwork = nothing
Set iMsg = nothing
Set iConf = nothing
Set Flds = nothing
Set objFSO = nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top