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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send email on pageload

Status
Not open for further replies.

colttaylor

Programmer
Aug 20, 2002
117
US
I am trying to replace a NetObjects Fusion created website with one that I can take care of in Frontpage. The one unique function which the site currently has, that I cannot figure out how to duplicate is...

Whenever someone surfs to the intro page, the owner of the company gets an email (50-60 per day). Whenever someone surfs to the download-demo page, the owner of the company gets a different email (2-3 per day).

Anybody know how to send an email when the page loads?

Thanks in advance!
Peace,
Colt

If it's stupid but it works, it isn't stupid
 
Easy one. You need to put some vbscript code into the ASP.

This will do the trick. Edit it for your SMTP server address and of course the content of what you want to send etc.

Code:
<%
 
Dim oMyIP, oTo, today

today=Right("0" & Month(Date),2) _
& "/" & Right("0" & Day(Date),2) _
& "/" & Right(Year(Date),2) _
& " at " & (Hour(Time)-3) & ":" & Right("0" & Minute(Time),2)

' Set the SMTP server IP for smtp.higleygroveshoa.com
oMyIP = "192.168.1.1" 
' Where do you want the message to be delivered
'oTo = "markdmac@thespidersparlor.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 = "webserver@thespidersparlor.com"
.Subject = "Somebody visited the web site" 
.TextBody = "Somebody visited the web site " & today & "."
End With

'// An attachment can be included.
'iMsg.AddAttachment Attachment

'Send the message.
iMsg.Send 

'return (0)

%>

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top