Hello,
I am new to asp email scripting but very familar with CDOSYS.
I have only used server 2003 enterprise and I am a much better administrator than understanding asp code.
Here is my problem
I want to be able to send contact forms on a website no matter the amount of fields.
I have succefully used these type of forms on my site but I was using modified versions of the awesome tutorial on this site:
http://www.ilopia.com/Articles/WindowsServer2003/CDO.aspx
This form works flawlessly and after hours upon hours and into days of trying to understand the logic I am still at a loss.
Here is the form as posted at this site:
01|<%
02|If Request.Form("btnSend").Count > 0 Then
03|
04| Set objMessage = CreateObject("CDO.Message")
05| objMessage.Subject = Request.Form("subject")
06| objMessage.Sender = Request.Form("From")
07| objMessage.To = Request.Form("To")
08| objMessage.TextBody = Request.Form("message")
09| objMessage.Send
10| Response.Redirect("Sent.html")
11|End If
12|%>
13|
14|<html>
15| <head>
16| <title>Send email with CDO</title>
17| </head>
18| <body>
19| <form name="sendEmail" action="EmailWithCDO.asp" method="post">
20| <table>
21| <tr>
22| <td>Subject:</td>
23| <td><input type="text" name="subject" /></td>
24| </tr>
25| <tr>
26| <td>From:</td>
27| <td><input type="text" name="from" /></td>
28| </tr>
29| <tr>
30| <td>To: </td>
31| <td><input type="text" name="to" /></td>
32| </tr>
33| <tr>
34| <td valign="top">Message: </td>
35| <td><textarea name="message" rows="6" cols="30">
36|</textarea></td>
37| </tr>
38| <tr>
39| <td colspan="2"><input type="submit" name="btnSend"
40|value="Send" /></td>
41| </tr>
42| </table>
43| </form>
44| </body>
45|</html>
OK here is what I have been able to do.
I was able to seperate the form and create the asp version to process the html form.
so I ended up with contact.html emailwithcdo.asp and action="emailwithcdo.asp"
the form emails just fine. Also if I add the schemas for a remote server and port I also come up fine.
Here is where I get very lost. So after feeling comfotable with what I THOUGHT I learned, when down the tubes it went when I did this.
New Form:
<%
If Request.Form("btnSend").Count > 0 Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Advertising Inquiry
objMessage.Sender = Request.Form("email")
objMessage.From = Request.Form("your_name")
objMessage.To = "myname@mydomain.com"
objMessage.TextBody = "Name: " & Request.Form("your_name") &_
vbcrlf & vbcrlf & "Company: " & Request.Form("company ") &_
vbcrlf & vbcrlf & "Office: " & Request.Form("office") &_
vbcrlf & vbcrlf & "Mobile: " & Request.Form("mobile") &_
vbcrlf & vbcrlf & "Fax: " & Request.Form("fax") &_
vbcrlf & vbcrlf & "E-mail: " & Request.Form("email") &_
vbcrlf & vbcrlf & "Address: " & Request.Form("address") &_
vbcrlf & vbcrlf & "City: " & Request.Form("city") &_
vbcrlf & vbcrlf & "State: " & Request.Form("state") &_
vbcrlf & vbcrlf & "Zip: " & Request.Form("zip") &_
vbcrlf & vbcrlf & "Drop Down Selection:" & vbcrlf & Request.Form("budget") &_
objMessage.Send
Response.Redirect("INDEX.html")
End If
%>
Here is the Html:
<form method="POST" action="emailwithcdo.ASP" target="_top">
<TABLE BORDER="0" cellpadding="2" cellspacing="0" width="95%">
<TR><TD VALIGN="TOP" nowrap>
Name:<br></td><td>
<INPUT TYPE="TEXT" NAME="Your_name" SIZE="25" CLASS="shadeform"><br>
</TD></TR><TR><TD nowrap>
Company:<br></td><td>
<INPUT TYPE="TEXT" NAME="company" SIZE="25" CLASS="shadeform"><br>
</TD></TR><TR><TD nowrap>
Office:<br></td><td>
<INPUT TYPE="TEXT" NAME="office" SIZE="25" CLASS="shadeform"><br>
</TD></TR><TR><TD nowrap>
Mobile:<br></td><td>
<INPUT TYPE="TEXT" NAME="mobile" SIZE="25" CLASS="shadeform"><br>
</TD></TR><TR><TD nowrap>
Fax:<br></td><td>
<INPUT TYPE="TEXT" NAME="fax" SIZE="25" CLASS="shadeform"><br>
</TD></TR><TR><TD nowrap>
E-Mail:<br></td><td>
<INPUT TYPE="TEXT" NAME="email" SIZE="25" CLASS="shadeform"><br>
</TD></TR><TR><TD nowrap>
Address:<br></td><td>
<INPUT TYPE="TEXT" NAME="address" SIZE="25" CLASS="shadeform"><br>
</TD></TR><TR><TD nowrap>
City:<br></td><td>
<INPUT TYPE="TEXT" NAME="city" SIZE="25" CLASS="shadeform"><br>
</TD></TR><TR><TD nowrap>
State/Zip:<br></td><td>
<INPUT TYPE="TEXT" NAME="state" SIZE="3" CLASS="shadeform"> <INPUT TYPE="TEXT" NAME="zip" SIZE="10" CLASS="shadeform"><br>
</td></tr><tr><td nowrap><br>
</td></tr></table>
<br>
<br>
Drop Down Selection:<br>
<select name="Budget" class="dropdown">
<option selected value="None selected">What is Your Budget? ------------->>></option>
<option value="100-200">$100-300</option>
<option value="300-400">$300-400</option>
<option value="400-500">$400-500</option>
<option value="500-and above">$500-And Above</option>
</select><BR>
</td></tr><tr><td colspan="2">
<br>
<br>
<input type="submit" name="btnSend">
<br>
</td></tr></table></form>
To me this form should work but It doesn't and for the life of me cannot figure it out.
I have been to every asp tutorial website there is and I get the method Request.Form and Request.Querystring. all are very good but I cannot see where they walk you through the logic into a completed form.
Would someone please help me with this? I want to understand how to collect data and submit it via email web forms.
Thanks very much
Signed
Frustrated