Forums

ASP

This topic is locked

ASP code help

Posted 10 Sep 2001 16:00:25
1
has voted
10 Sep 2001 16:00:25 Phuc Ngo posted:
Hi All,

Could someone help me with this ASP code. This is a form that email all the
information to an email specify. I got this code out of a tutorial site and
it seem to be working fine. The problem is that in the tutorial, the author
only uses two variables and he uses the line code below to display it:

objCDO.Body ="Name: " & ename & " " & branch

The result is this:
Name: John Research

I want to display more than one variable and in this format:

Name: John
Branch: Research
Email:
Suggestion:
This is a test

How do I write this code in this command line to display the information just like above?

objCDO.Body = ???


Below is the whole code for the mail I got from the tutorial.
Thank you for all your help in dvance.
-dave


<%
if Request.Querystring("isSubmitted" = "yes" then

Dim ename, branch, email, suggestion
Dim objCDO

ename = Request.Querystring("Name"
branch = Request.Querystring("Branch"
email = Request.Querystring("Email"
suggestion = Request.Querystring("Technical_Suggestion"

Set objCDO = Server.CreateObject("CDONTS.NewMail"

objCDO.From = email
objCDO.To =" "
objCDO.Cc =""
objCDO.Subject ="Technical Suggestions"
objCDO.Body ="Name: " & ename & " " & branch

objCDO.BodyFormat = 1
objCDO.MailFormat = 1

objCDO.Send

ConfirmMsg = "Thank you for submitting your suggestions."

end if
%>

Replies

Replied 10 Sep 2001 17:32:08
10 Sep 2001 17:32:08 Viktor Farcic replied:
Something like this:

<%
if Request.Querystring("isSubmitted" = "yes" then

Dim ename, branch, email, suggestion
Dim objCDO, strBodyText

ename = Request.Querystring("Name"
branch = Request.Querystring("Branch"
email = Request.Querystring("Email"
suggestion = Request.Querystring("Technical_Suggestion"
strBodyText = "Name: " & ename & "<br>"
strBodyText = strBodyText & "Branch: " & branch & "<br>"
strBodyText = strBodyText & "eMail: " & email & "<br>"
strBodyText = strBodyText & "Suggestion: " & suggestion & "<br>"

Set objCDO = Server.CreateObject("CDONTS.NewMail"

objCDO.From = email
objCDO.To =" "
objCDO.Cc =""
objCDO.Subject ="Technical Suggestions"
objCDO.Body = strBodyText

objCDO.BodyFormat = 1
objCDO.MailFormat = 1

objCDO.Send

ConfirmMsg = "Thank you for submitting your suggestions."

end if
%>

Replied 10 Sep 2001 21:52:20
10 Sep 2001 21:52:20 Phuc Ngo replied:
Hi...

After I cut and pasted your code, all the variables were able to display, but the format came out like this:

Name: Dave<br>Branch: Test Division<br>Email:
<br>Suggestion: This is a test<br>

How do I get it to display it like this

Name: Dave
Branch: Test Division
Email:
Suggestion:
This is a test

Thanks.
-dave

Replied 12 Sep 2001 01:10:41
12 Sep 2001 01:10:41 Viktor Farcic replied:
Try changing two lines:

objMail.MailFormat = cdoMailFormatMime
objMail.BodyFormat = cdoBodyFormatHTML

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi...

After I cut and pasted your code, all the variables were able to display, but the format came out like this:

Name: Dave&lt;br&gt;Branch: Test Division&lt;br&gt;Email:
&lt;br&gt;Suggestion: This is a test&lt;br&gt;

How do I get it to display it like this

Name: Dave
Branch: Test Division
Email:
Suggestion:
This is a test

Thanks.
-dave


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Replied 12 Sep 2001 01:58:11
12 Sep 2001 01:58:11 Owen Eastwick replied:
If you want to send mail SMTP (Simple Mail Text Protocol)try the following:
<pre id=code><font face=courier size=2 id=code>
strBodyText = "Name: " & ename & vbCrLf
strBodyText = strBodyText & "Branch: " & branch & vbCrLf
strBodyText = strBodyText & "eMail: " & email & vbCrLf
strBodyText = strBodyText & "Suggestion: " & suggestion & vbCrLf</font id=code></pre id=code>

(vbCrLf = Visual Basic Carriage Return Line Feed)

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 12 Sep 2001 14:44:16
12 Sep 2001 14:44:16 Phuc Ngo replied:
Thank you all, both suggestions works!

-Dave



Reply to this topic