ASP Form Problem

D

David Cairns

Hi

can anyone help me i am new to asp and going mad, why would the
following only display the last line in the email, i.e the history
text.

thanks David Cairns

<%@ Language=VBScript %>
<%
Dim objMail
Set objMail = server.CreateObject("CDONTS.NewMail")
objMail.From = "(e-mail address removed)"
objMail.To = "(e-mail address removed)"
objMail.Subject = "Wanted Morgan Form"
objMail.Body = Request.Form("Name")
objMail.Body = Request.Form("Your Address")
objMail.Body = Request.Form("Post Code")
objMail.Body = Request.Form("Phone")
objMail.Body = Request.Form("Morgan/Model")
objMail.Body = Request.Form("Mile")
objMail.Body = Request.Form("spec")
objMail.Body = Request.Form("History")
objMail.BodyFormat = CdoBodyFormatHTML
objMail.MailFormat = CdoMailFormatMime
objMail.Send
set objMail=nothing
Response.Redirect "finform.htm"

%>
 
S

Seeker

David Cairns said:
Hi

can anyone help me i am new to asp and going mad, why would the
following only display the last line in the email, i.e the history
text.

Try the following...

objMail.Body = objMail.Body & Request.Form("History")
 
D

davidc

When i add that line the sendmail.asp stops working, and page cannot be
found error comes up......

any more advice would be much appreciated

cheers

David
 
R

Roland Hall

:
: can anyone help me i am new to asp and going mad, why would the
: following only display the last line in the email, i.e the history
: text.
:
: thanks David Cairns
:
: <%@ Language=VBScript %>
: <%
: Dim objMail
: Set objMail = server.CreateObject("CDONTS.NewMail")
: objMail.From = "(e-mail address removed)"
: objMail.To = "(e-mail address removed)"
: objMail.Subject = "Wanted Morgan Form"
: objMail.Body = Request.Form("Name")
: objMail.Body = Request.Form("Your Address")
: objMail.Body = Request.Form("Post Code")
: objMail.Body = Request.Form("Phone")
: objMail.Body = Request.Form("Morgan/Model")
: objMail.Body = Request.Form("Mile")
: objMail.Body = Request.Form("spec")
: objMail.Body = Request.Form("History")
: objMail.BodyFormat = CdoBodyFormatHTML
: objMail.MailFormat = CdoMailFormatMime
: objMail.Send
: set objMail=nothing
: Response.Redirect "finform.htm"
:
: %>

Try changing these lines:
: objMail.Body = Request.Form("Name")
: objMail.Body = Request.Form("Your Address")
: objMail.Body = Request.Form("Post Code")
: objMail.Body = Request.Form("Phone")
: objMail.Body = Request.Form("Morgan/Model")
: objMail.Body = Request.Form("Mile")
: objMail.Body = Request.Form("spec")
: objMail.Body = Request.Form("History")

To:
dim oBody
oBody = Request.Form("Name") & vbCrLf
oBody = oBody & Request.Form("Name") & vbCrLf
oBody = oBody & Request.Form("Your Address") & vbCrLf
oBody = oBody & Request.Form("Post Code") & vbCrLf
oBody = oBody & Request.Form("Phone") & vbCrLf
oBody = oBody & Request.Form("Morgan/Model") & vbCrLf
oBody = oBody & Request.Form("Mile") & vbCrLf
oBody = oBody & Request.Form("spec") & vbCrLf
oBody = oBody & Request.Form("History") & vbCrLf
objMail.Body = oBody

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
D

davidc

Thanks so much it now all works,

but sorry to be a pain, how could i format the results so they were
displayed line by line.

thanks again

David
 
R

Roland Hall

:
: Thanks so much it now all works,
:
: but sorry to be a pain, how could i format the results so they were
: displayed line by line.

Sorry. I forgot HTML email needs HTML breaks.

dim oBody
oBody = Request.Form("Name") & "<br />" & vbCrLf
oBody = oBody & Request.Form("Name") & "<br />" & vbCrLf
oBody = oBody & Request.Form("Your Address") & "<br />" & vbCrLf
oBody = oBody & Request.Form("Post Code") & "<br />" & vbCrLf
oBody = oBody & Request.Form("Phone") & "<br />" & vbCrLf
oBody = oBody & Request.Form("Morgan/Model") & "<br />" & vbCrLf
oBody = oBody & Request.Form("Mile") & "<br />" & vbCrLf
oBody = oBody & Request.Form("spec") & "<br />" & vbCrLf
oBody = oBody & Request.Form("History") & "<br />" & vbCrLf
objMail.Body = oBody

If that doesn't work, try this:

dim oBody
oBody = Request.Form("Name") & "%0d%0a" & vbCrLf
oBody = oBody & Request.Form("Name") & "%0d%0a" & vbCrLf
oBody = oBody & Request.Form("Your Address") & "%0d%0a" & vbCrLf
oBody = oBody & Request.Form("Post Code") & "%0d%0a" & vbCrLf
oBody = oBody & Request.Form("Phone") & "%0d%0a" & vbCrLf
oBody = oBody & Request.Form("Morgan/Model") & "%0d%0a" & vbCrLf
oBody = oBody & Request.Form("Mile") & "%0d%0a" & vbCrLf
oBody = oBody & Request.Form("spec") & "%0d%0a" & vbCrLf
oBody = oBody & Request.Form("History") & "%0d%0a" & vbCrLf
objMail.Body = oBody
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top