PDA

View Full Version : ASP form is troubling me



zephn
February 1st, 2003, 02:06 PM
I have a script I downloaded from an ASP tutorial site. It had a "subject" box and a "body" input box.
I myself have need of 5 boxes in total and I need them displayed in the body of the email.
If Anyone out there who knows ASP can tell me by looking at this asp form belowwhat I must do to have all the input boxes displayed in the body of the email please let me know.



Dim strTo, strSubject, strBody, strWho, strWhen, strHowMany, strEmail, strPhone
Dim objCDOMail 'The CDO object
'#################################################
##############

strTo = "zephn@sympatico.ca"
strSubject = Request.Form("subject")
strBody = Request.Form("body")
strFrom=request.form("strwho")
strPhone=request.form("strPhone")
strDate=request.form("strwhen")
strPeople=request.form("strhowmany")
strBody=request.form("stremail")


Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'#################################################
##############

objCDOMail.From = "RSVPForm"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.Send
Set objCDOMail = Nothing

abzoid
February 1st, 2003, 04:52 PM
You just need to combine those additional form values into the CDOmail.body like this.

objCDOMail.Subject = strSubject

strDate = "Date: " + strDate + VbCrLf
strWho = "From: " + strWho + VbCrLf
strPhone = "Phone: " + strPhone + VbCrLf
strPeople = "How many: " + strPeople + VbCrLf + VbCrLf

objCDOMail.Body = strDate + strWho + strPhone + strPeople + strBody

note: VbCrLf is the command for a carriage return with line feed.

Does that all make sense?

abzoid

DDD
February 3rd, 2003, 01:49 AM
ASP is kinda picky on this, but you should show your line feeds like this

& vbcrlf & _


that will break the line and wont return errors...Learned this first hand

abzoid
February 3rd, 2003, 02:17 PM
Actually the "& _" lets the server know that the current command continues on the next line. There is a limit for number of characters on a line, so for the lengthy string commands often used in custom form mail scripts it's a very handy tool. I like to keep my commands to one line each as I find them easier to debug. Just a personal preference and a throwback to the PASCAL coding I learned over 20 years ago.

abzoid


Originally posted by 3d-iva
ASP is kinda picky on this, but you should show your line feeds like this

& vbcrlf & _


that will break the line and wont return errors...Learned this first hand

DDD
February 3rd, 2003, 02:22 PM
yeah it was the weirdest thing it should have worked the way you have yours but with mine I was getting errors. So when I found that it worked when I did it this way I just kinda kept doing it......