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

Sending current date in cdonts I keep getting errors 1

Status
Not open for further replies.

Reynet01

Technical User
Apr 27, 2004
59
US
Trying to send e-mail using CDONTS but I keep getting eeror when I try and add the current date to one of the body lines

MyBody = MyBody & "Date code was generated: " + =date() & vbCrLf



Here is the full code- Thanks for any help

<%
email=session("x_email")
site= sitecode
Machine= machineid
currentime=date()
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From= "Me <Helpdesk@somewhere.us>"
MyCDONTSMail.To= email
MyCDONTSMail.Subject="License registration receipt for: " + request.form("CustomerNametext")
MyBody="Below are the details of your purchase." & vbCrLf & vbCrLf & vbCrLf
MyBody =Mybody & "Product Registerd: " + nm(1) & vbCrLf
MyBody =MyBody & "Registering Technician: "+ session("x_firstname") +" "+ session("x_lastname") & vbCrLf
MyBody = MyBody & "Date code was generated: " + =date() & vbCrLf
MyBody = MyBody & "Sitecode of Machine: " + request.form("frmsitecode") & vbCrLf
MyBody = MyBody & "Activation Code for Product: " + & vbCrLf
MyBody = MyBody & "E-mail Support: service@theprogrammers.com" & vbCrLf
MyBody = MyBody & "Sample Phone Number " & vbCrLf & vbCrLf & vbCrLf
MyBody = MyBody & "Once again thank you for your purchase" & vbCrLf & vbCrLf
MyBody = MyBody & "Sample Text"
MyCDONTSMail.Body= MyBody
MyCDONTSMail.Send
set MyCDONTSMail=nothing
%>

If knowledge were power I would be a AAA battery!
 
Bad string concatination:

MyBody & "Date code was generated: " [highlight]+ =[/highlight]date() & vbCrLf

PS: You might want to see about using CDO instead of CDONTS... the latter has been discontinued and is no longer supported... it might break if someone upgrades the operating system on your web server.
 
I tried using
MyBody = MyBody & "Date code was generated: " Date() & vbCrLf

But I get the following error:


Microsoft VBScript compilation error '800a0401'

Expected end of statement

/disttemp/result.asp, line 251

MyBody = MyBody & "Date code was generated: " Date() & vbCrLf
----------------------------------------------^


If knowledge were power I would be a AAA battery!
 
You left out an ampersand after the string and before the call to the Date method.
 
Thanks that was simple I was using + instead of & on previous attempts. I guess I need to stop using that.

If knowledge were power I would be a AAA battery!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top