Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 1st, 2004, 04:23 PM
rianashley rianashley is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 rianashley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 9 m 40 sec
Reputation Power: 0
email forms cdonts

I downloaded asp code for a form from http://www.planet-source-code.com/v...&txtCodeId=6386

The code sends an HTML email with some basic information to an email account and a link to view the completed form. It uses CDONTS to send the information. The link contains all the information the user entered on the form and when you click on the link, it populates the form with that information. However, I don't receive the e-mail. I inserted my e-mail address but never received the form. I e-mailed the author but never heard back from him. I'm sure it's something I am doing wrong. Can anyone help me?

Here is the code for the emailform:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<TITLE></TITLE>
<!--#include file="scripts.asp"-->

</HEAD>
<BODY>
<H2><FONT COLOR="#336699">Email Form</FONT></H2> <FORM ACTION="submitform.asp" Method="Post" >
<INPUT TYPE="hidden" NAME="FormName" VALUE="emailform.asp">
<INPUT TYPE="hidden" NAME="subject" VALUE="Email Form Sample">
<INPUT TYPE="hidden" NAME="SendTo" VALUE="lindajo13@hotmail.com">
<TABLE WIDTH="274" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD COLSPAN="2" ALIGN="CENTER" WIDTH="274"></TD>
</TR>
<TR>
<TD WIDTH="88">Name:</TD>
<TD WIDTH="186"><INPUT TYPE="TEXT" NAME="txtName" <%Call RequestInfo("txtName", "")%>></TD>
</TR>
<TR>
<TD WIDTH="88">Address:</TD>
<TD WIDTH="186"><INPUT TYPE="TEXT" NAME="txtAddress" <%Call RequestInfo("txtAddress", "")%>></TD>
</TR>
<TR>
<TD WIDTH="88">Phone:</TD>
<TD WIDTH="186"><INPUT TYPE="TEXT" NAME="txtPhone" <%Call RequestInfo("txtPhone", "")%>></TD>
</TR>
<TR>
<TD WIDTH="88">Email:</TD>
<TD WIDTH="186"><INPUT TYPE="TEXT" NAME="txtEmail" <%Call RequestInfo("txtEmail", "")%>></TD>
</TR>
<TR>
<TD WIDTH="88">Gender:</TD>
<TD WIDTH="186"><INPUT TYPE="RADIO" NAME="radGender" VALUE="m"
<%Call RequestInfo("radGender", "m")%>>Male&nbsp;<INPUT TYPE="RADIO" NAME="radGender"
VALUE="f" <%Call RequestInfo("radGender", "f")%>>Female</TD>
</TR>
<TR>
</TR>
<TR>
<TD COLSPAN="2" WIDTH="274"><BR><B>Check all that apply:</B></TD>
</TR>
<TR>
<TD COLSPAN="2">&nbsp;&nbsp;<INPUT TYPE="CHECKBOX" NAME="chkVB" <%Call RequestInfo("chkVB", "on")%>>
Visual Basic<BR>&nbsp;&nbsp;<INPUT TYPE="CHECKBOX" NAME="chkASP" <%Call RequestInfo("chkASP", "on")%>> ASP<BR>
&nbsp;&nbsp;<INPUT TYPE="CHECKBOX" NAME="chkJava" <%Call RequestInfo("chkJava", "on")%>> Java<BR>&nbsp;&nbsp;<INPUT
TYPE="CHECKBOX" NAME="chkOther" <%Call RequestInfo("chkOther", "on")%>> Other&nbsp;<INPUT TYPE="TEXT"
NAME="txtOther" <%Call RequestInfo("txtOther", "")%>><BR><BR></TD>
</TR>
<TR>
<TD COLSPAN="2" WIDTH="274" ALIGN="RIGHT"><INPUT TYPE="SUBMIT"
NAME="Submit" VALUE="Send Now!"></TD>
</TR>
</TABLE></FORM> </BODY>
</HTML>


Here is the code for the submitform:

<%
'======================================'
'if have any comments, let me know.
'email richardt@proactivect.com
'======================================'

'change this to the appropriate http
Const strHTTP = "http://lindadesk/"
'get current date
strDate = Date()
'get form information
strFormName = Request("FormName")
strSubject = Request("subject")
strSendTo = Request("SendTo")
strName = Request("txtName")
strPhone = Request("txtPhone")
'if no information entered for email use your own
if instr(Request("txtEmail"), "@") <> 0 then
strFrom = Request("txtEmail")
else
strFrom = strSendTo
end if
'concat URL information
strURLInfo = strHTTP & strFormName & "?" & Request.Form()
'create the HTML for email
strHTML = "<HTML> <HEAD> <TITLE></TITLE> </HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<TABLE WIDTH=500 CELLPADDING=0 CELLSPACING=0>"
strHTML = strHTML & "<TR>"
'use some graphics for email
strHTML = strHTML & "<TD><IMG SRC=" & strHTTP & "emailbanner.JPG BORDER=0></TD>"
strHTML = strHTML & "</TR>"
'include basic info in email
strHTML = strHTML & "<TR>"
strHTML = strHTML & "<TD>"
strHTML = strHTML & "<BR>Date: " & strDate
strHTML = strHTML & "<BR>Subject: " & strSubject
strHTML = strHTML & "<BR>Requested by: " & strName
strHTML = strHTML & "<BR>Phone: " & strPhone
if strFrom <> strSendTo then
strHTML = strHTML & "<BR>Email: <a href=mailto:" & strFrom & ">" & strFrom & "</a>"
else
strHTML = strHTML & "<BR>Email: UNKNOWN"
end if
'add hyperlink to form in email
strHTML = strHTML & "<BR><BR>"
strHTML = strHTML & "<A HREF=" & strURLInfo & "><IMG SRC=" & strHTTP & "form.gif WIDTH=16 HEIGHT=16 BORDER=0>Click here</A>"
strHTML = strHTML & " to view completed form."
strHTML = strHTML & "</TD>"
strHTML = strHTML & "</TR>"
strHTML = strHTML & "<TR>"
strHTML = strHTML & "<TD></TD>"
strHTML = strHTML & "</TR>"
strHTML = strHTML & "</TABLE>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

'time to send the email
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.To = strSendTo
objCDO.From = strFrom
objCDO.Subject = strName & " - " & strSubject
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
objCDO.Body = strHTML
objCDO.Send
set objCDO = nothing

'redirect to the "Thanks" page
Response.Redirect strHTTP & "submitdone.htm"
%>


Rianashley
email: lindajo13@hotmail.com.

Reply With Quote
  #2  
Old August 2nd, 2004, 10:17 AM
selwonk's Avatar
selwonk selwonk is offline
Contributing User
ASP Free Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2004
Posts: 2,942 selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 9 h 49 m 28 sec
Reputation Power: 62
Hi

Let's presume that because you are changing a published and well tested script that the fault lies with your system's ability to send the email, rather than a bug in the form. Try creating the following ASP script:

Code:
<%
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.To = "send.to@emailaddress.com"
objCDO.From = "sent.from@emailaddress.com"
objCDO.Subject = "Test message" 
objCDO.BodyFormat = 0 
objCDO.MailFormat = 0 
objCDO.Body = "<html><body>Test message</body></html>"
objCDO.Send 
set objCDO = nothing
%>


If this script does not work we might have to presume that CDO is not working correctly

MK

Reply With Quote
  #3  
Old August 2nd, 2004, 11:07 AM
rianashley rianashley is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 rianashley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 9 m 40 sec
Reputation Power: 0
Okay, I will try this. Thanks.

Rianashley

Reply With Quote
  #4  
Old August 3rd, 2004, 10:45 AM
rptasiuk rptasiuk is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 rptasiuk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 sec
Reputation Power: 0
If you are testing this locally, make sure you have your SMTP service installed and running. Also... What OS version are you running on? CDONTS does not work on XP or Windows 2003. You would have to use CDOsys. More info at MSDN here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_creating_a_message_object.asp

Another item to look for is that the send to and from addresses must be correctly formatted email addresses or the message will not be sent; without any error or warning messages.

Reply With Quote
  #5  
Old August 5th, 2004, 10:36 AM
rianashley rianashley is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 rianashley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 9 m 40 sec
Reputation Power: 0
CDONTS email

I have Windows 2000 Professional. I am also running the Service Pack 4 for Windows 2000 Professional. Do you know if this may present a problem?

Rianashley

Last edited by rianashley : August 5th, 2004 at 10:37 AM. Reason: typo

Reply With Quote
  #6  
Old August 5th, 2004, 11:02 AM
rptasiuk rptasiuk is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 rptasiuk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 sec
Reputation Power: 0
Windows 2000 still supports CDONTS as well as CDOSYS. However, it is not a bad idea to start using CDO instead. It is not that much different and will guarantee that your scripts will work on future upgrades.

Here is a sample that uses the pickup directory of SMTP running on the local machine. Other schemas are available at the link I posted earlier, for example, network send for a remote SMTP server, or even posting directly to a newsgroup. Choose "Configuring the Message Object" from the menu for more info on this.

Dim iMsg
Dim iConf
Dim Flds

Const cdoSendUsingPickup = 1

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPickup
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")="c:\Inetpub\mailroot\pickup"
.Update
End With

With iMsg
Set .Configuration = iConf
.From = "From<from@domain.com>"
.Subject = "Subject of Message"
.To = "someone@somedomain.com"
' .cc = ""
' .bcc = ""
.TextBody = "Text only Message body goes here"
' .HTMLBody = "for HTML formatted messages"
.send
End With

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

Reply With Quote
  #7  
Old August 5th, 2004, 05:53 PM
rianashley rianashley is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 rianashley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 9 m 40 sec
Reputation Power: 0
Okay, I'm sure it's probably something I'm doing wrong as I am new to this. I will look into using CDOSYS as well. Thanks for your help.

Rianashley

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > email forms cdonts


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway