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

Sending Mail from ASP with CDONTS.NewMail Object

Status
Not open for further replies.

mwebbo1

Technical User
Jul 11, 2002
71
US
I have a form that is being processed using CDONTS. Now, it is doing a loop request and getting all the data from an application and sending it to an email address. I need to make the data appear more logical. I want to request each item in a particular order, how do I do this? Here is the code that I am using right now.
----------
<%
Option Explicit

Dim objNewMail

' First create an instance of NewMail Object
Set objNewMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

' setting up the email

objNewMail.From = request(&quot;email&quot;)
objNewMail.To = &quot;myemail@email.com&quot;

objNewMail.Subject = &quot;Online Application&quot;

Dim e
Dim strBody
For Each e in Request.Form
strBody = strBody & e & &quot; = &quot; & Request(e) & chr(10)

Next
objNewMail.Body = strBody


objNewMail.Send

' After the Send method, NewMail Object become Invalid

Set objNewMail = Nothing

'Response.Write &quot;Email has been sent&quot;
Response.Redirect(&quot;index.asp&quot;)


%>

 
I know, the thing is that I have no Idea what the actual code is, the form was a template that I have had and never needed it to be in any particular order. But, now I have an online application going and there are a lot fields that are being sent. Would you mind showing me how to code eash one, for example, making one line for like phone number. THen I will see all the places that I have to hand write. Thanks in advance if you can help, I just have no idea where to start.
 
ok...would I remove the whole block of code.
Dim e
Dim strBody
For Each e in Request.Form
strBody = strBody & e & &quot; = &quot; & Request(e) & chr(10)
 
thanks a ton, I really appreciate that , oh, I do have to keep the DIM lines right, or no?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top