Forums

ASP

This topic is locked

CS3 Sending email after Insert/Update Record

Posted 07 Feb 2010 12:18:56
1
has voted
07 Feb 2010 12:18:56 David BK posted:
Hi peeps...

Something's going on with my CS3 and its insert/update record behaviours.

Throughout the entire site I have a number of insert/update behaviours and the majority of them send out some kind of confirmation email to the customer.

I use CDO to send the message, which is put together by reading the entire contents of an HTML template for the email and then replacing various aspects of it by placeholders within the code... e.g. #SURNAME# is replaced with the customer's Surname and so on.

The code all functions fine, but for some reason I'm now unable to open some of these ASP pages in Dreamweaver.... sometimes I'm able to actually open the file (and then it crashes) or sometimes just passing my cursor over the filename in the list of files within dreamweaver causes Dreamweaver to crash.

To clarify, my email code is inserted after "MM_editCmd.ActiveConnection.Close" and before "' append the query string to the redirect URL" - and it's been working fine like this for years.

It's beginning to get quite inconvenient now... can anyone offer any guidance as to what may be wrong?

My actual email code is as follows:

' SEND CUSTOMER EMAIL 

	'These constants are defined to make the code more readable
	Const ForReading = 1, ForWriting = 2, ForAppending = 8
	Dim fso, f
	Set fso = CreateObject("Scripting.FileSystemObject")
	'Open the file for reading
	Set f = fso.OpenTextFile("C:\home\LocalUser\website\EmailTemplates\Template1.htm", ForReading)
	'The ReadAll method reads the entire file into the variable BodyText
	BodyText = f.ReadAll
	'Close the file
	f.Close
	Set f = Nothing
	Set fso = Nothing

	Set objMessage = CreateObject("CDO.Message") 
	objMessage.Subject = "Hello - this is the subject" 
	objMessage.From = "This Website<this@website.com>" 
	objMessage.To = (EMAIL)
	objMessage.BCC = "this@website.com"
	objMessage.HTMLBody = BodyText
	'CONTACT DETAILS	
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#TITLE#",(TITLE))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#SURNAME#",(SURNAME))
	'NEW DETAILS
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWMAKE#",(MAKE))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWMODEL#",(MODEL))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWDERIV#",(Request.Form("txt_Deriv")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWREG#",(Request.Form("txt_RegNum")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWCHASSIS#",(Request.Form("txt_ChassNum")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWDOR#",(Request.Form("txt_DOR")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWMILES#",(Request.Form("txt_Miles")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWCCS#",(Request.Form("txt_CCs")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWPPRICE#",(Request.Form("txt_Price")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWFINCOM#",(Request.Form("txt_FinanceComp")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWDOP#",(Request.Form("txt_DOP")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWTRANS#",(Request.Form("Veh_Transmission")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWMOTEXPIRES#",(Request.Form("txtMOT")))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#NEWPURCHFROM#",(Request.Form("txt_PurchFrom")))
	'CHANGE #CUS ID#
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#CusID#",(UserID))
	objMessage.HTMLBody = Replace(objMessage.HTMLBody,"#VehID#",(VehID))
	'SEND email
	objMessage.Send

Reply to this topic