Nicole Henningsen's Blog
Posted At : February 1, 2008 12:10 PM | Posted By : Nicole Henningsen

Go Daddy ASP CDONTs form mail issue CONTINUED

I have received a lot of emails on the go daddy form mail issue. I have written an example to post for everyone that should help you out in a little more detail. This is a very raw form but it has been tested and it does work.

Below you will find an example of a very basic form for an estimate. This form will collect the data and post to a page called start_thanksN.asp. So you will need to start out by creating a blank HTML page (or whatever language you decide to use). You will enter your form data and post the data to your processing page. For this example I am posting mine to start_thanksN.asp.

<html>
<head>
<title>Example for submit using ASP and Cdont</title>
</head>

<body>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
   <tr>
   <td width="94%" valign="top">
       <form name="form1" method="post" action="start_thanksN.asp" onSubmit="return checkForm()">
    <input type="hidden" name="recipients" value="YOUR EMAIL ADDRESS">
<input type="hidden" name="subject" value="Form Submission">
<input type="hidden" name="redirect" value="thankyou.html">
<table width="60%" border="0" align="center" cellpadding="2" cellspacing="0">
    <tr valign="top">
    <td width="27%" nowrap><div align="right"><font size="2">Name:</font></div></td>
<td width="73%"><div align="left"><input name="txtName" type="text" id="txtName12" size="30"></div></td>
</tr>
<tr valign="top">
   <td nowrap><div align="right"><font size="2">Address:</font></div></td>
<td><div align="left"> <input name="txtAddress" type="text" id="txtAddress2" size="30"></div></td>
</tr>
<tr valign="top">
<td nowrap><div align="right"><font size="2">City:</font></div></td>
<td><div align="left"><input name="txtCity" type="text" id="txtCity2" size="30"></div></td>
</tr>
<tr valign="top">
<td nowrap><div align="right"><font size="2">State:</font></div></td>
<td><div align="left"><input name="txtState" type="text" id="txtState2" size="30"></div></td>
</tr>
<tr valign="top">
<td nowrap><div align="right"><font size="2">Zip:</font></div></td>
<td><div align="left"><input name="txtZip" type="text" id="txtZip2" size="15"></div></td>
</tr>
<tr valign="top">
<td nowrap><div align="right"><font size="2">Phone:</font></div></td>
<td><div align="left"><input name="txtPhone1" type="text" id="txtPhone12" size="30"></div></td>
</tr>
<tr valign="top">
<td nowrap><div align="right"><font size="2">Alternate Phone:</font></div></td>
<td><div align="left"><input name="txtPhone2" type="text" id="txtPhone22" size="30"></div></td>
</tr>
<tr valign="top">
   <td nowrap><div align="right"><font size="2">Best Time to Call:</font></div></td>
<td><div align="left"><font size="2"><input name="chkMorning" type="checkbox" id="chkMorning" value="Morning">Morning
<input name="chkAfternoon" type="checkbox" id="chkAfternoon" value="Afternoon">Afternoon <br>
<input name="chkEvening" type="checkbox" id="chkEvening" value="Evening">Evening
<input name="chkAny" type="checkbox" id="chkAny" value="Any Time">Any Time </font></div></td>
</tr>
<tr valign="top">
   <td nowrap><div align="right"><font size="2">Email Address:</font></div></td>
<td> <div align="left"><input name="txtEmail" type="text" id="txtEmail" size="30"></div></td>
</tr>
<tr valign="top">
   <td nowrap><div align="right"><font size="2">Service Type:</font></div></td>
<td nowrap><div align="left"><input name="chkDesign" type="checkbox" id="chkDesign" value="Design">
<font size="2">Design</font><font size="2">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="chkNet" type="checkbox" id="chkNet" value="Net">
. Net<br>
<input name="chkColdFusion" type="checkbox" id="chkColdFusion" value="ColdFusion">
ColdFusion
<input name="chkPHP" type="checkbox" id="chkPHP" value="PHP">
PHP <br>
<input name="chkFlex" type="checkbox" id="chkFlex" value="Flex">
Flex<br>
<input name="chkASP" type="checkbox" id="chkASP" value="ASP">
ASP
<br>
                              <input name="chkDev" type="checkbox" id="chkDev" value="Development">
                              Development<br>
</font></div></td>
</tr>
<tr valign="top">
<td nowrap><div align="right"><font size="2">Current Site URL:</font></div></td>
<td><div align="left"><input name="txtURL" type="text" id="txtURL" size="45">
</div></td>
</tr>
<tr valign="top">
<td nowrap><div align="right"><font size="2">Message:</font></div></td>
<td><div align="left"><textarea name="txtMessage" cols="30" rows="4" id="txtMessage"></textarea></div></td>
</tr>
</table>
<div align="center"><br><input type="submit" name="Submit" value="Submit"><br></div>
         </form>
    </td>
    </tr>
</table>
</body>
</html>
Now that we have our form created we need to post our form to our processing page. You will need to create a blank .ASP page. The page should be the same name as your post in your form tag in your html page. This is where we will place all of our CDONTs code and post a confirmation that the email was sent.

<%@ LANGUAGE = VBScript %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Thank you</title>

<%
Dim theName
theName = request("txtName")
Dim theAddress
theAddress = request("txtAddress")
Dim theCity
theCity = request("txtCity")
Dim theState
theState = request("txtState")
Dim theZip
theZip = request("txtZip")
Dim thePhoneNum
thePhoneNum = request("txtPhone1")
Dim thePhoneNum2
thePhoneNum2 = request("txtPhone2")
Dim callTimeMorning
callTimeMorning = request("chkMorning")
Dim callTimeAfternoon
callTimeAfternoon = request("chkAfternoon")
Dim callTimeEvening
callTimeEvening = request("chkEvening")
Dim callTimeAny
callTimeAny = request("chkAny")
Dim theEmail
theEmail = request("txtEmail")
Dim serviceDesign
serviceDesign = request("chkDesign")
Dim serviceNet
serviceNet = request("chkNet")
Dim serviceColdFusion
serviceColdFusion = request("chkColdFusion")
Dim serviceFlex
serviceFlex = request("chkFlex")
Dim serviceRaking
serviceRaking = request("chkRaking")
Dim serviceASP
serviceASP = request("chkASP")
Dim servicePHP
servicePHP = request("chkPHP")
Dim serviceDev
serviceDev = request("chkDev")
Dim siteURL
siteURL = request("txtURL")
Dim theMessage
theMessage = request("txtMessage")

if not theName = "" then
'sends email to myself

Set myMail=CreateObject("CDO.Message")
myMail.Subject="Testing CDO form mail by Nicole Rutter"
myMail.From=theEmail
myMail.To="nicole@cfwebtools.com"
BodyText = "*********** Request For Estimate ***************" &chr(13) &chr(10)

BodyText = BodyText & "Name: " & theName &chr(13) &chr(10) & "Address: " & theAddress &chr(13) &chr(10) & "City: " & theCity &chr(13) &chr(10) & "State: " & theState &chr(13) &chr(10) + "Zip Code: " & theZip &chr(13) &chr(10)

BodyText = BodyText & "Phone Number: " & thePhoneNum &chr(13) &chr(10) & "Alternate Phone Number: " & thePhoneNum2 &chr(13) &chr(10) & "Best Time to Call: " & callTimeMorning & " " & callTimeAfternoon & " " & callTimeEvening & " " & callTimeAny &chr(13) &chr(10)& "Email Address: " & theEmail &chr(13) &chr(10) &chr(13) &chr(10) & "Services Requested: " &chr(13) &chr(10)
Dim ServiceRequest
if not serviceDesign = "" then
ServiceRequest = serviceDesign &chr(13) &chr(10)
end if
if not serviceNet = "" then
ServiceRequest = ServiceRequest + serviceNet &chr(13) &chr(10)
end if
if not serviceColdFusion = "" then
ServiceRequest = ServiceRequest + serviceColdFusion &chr(13) &chr(10)
end if
if not serviceFlex = "" then
ServiceRequest = ServiceRequest + serviceFlex &chr(13) &chr(10)
end if
if not serviceRaking = "" then
ServiceRequest = ServiceRequest + serviceRaking &chr(13) &chr(10)
end if
if not serviceASP = "" then
ServiceRequest = ServiceRequest + serviceASP &chr(13) &chr(10)
end if
if not servicePHP = "" then
ServiceRequest = ServiceRequest + servicePHP &chr(13) &chr(10)
end if
if not serviceDev = "" then
ServiceRequest = ServiceRequest + serviceDev &chr(13) &chr(10)
end if

BodyText = BodyText & ServiceRequest &chr(13) &chr(10) & URL: " & siteURL & " URL" &chr(13) &chr(10) &chr(13) &chr(10)
BodyText = BodyText & "
Message: " & theMessage &chr(13) &chr(10)

myMail.TextBody=BodyText
myMail.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="
relay-hosting.secureserver.net"
'Server port
myMail.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing


end if
%>
</head>
<body>
<table width="807" border="0" align="center" cellpadding="p" cellspacing="0">
<tr>
<td width="622" valign="top" bgcolor="#FFFFFF">
The form has been sent thank you. <br> <br></td>
</tr>
</table>

I hope this will give everyone a little better understanding of how to get your form mail working on go daddy. If your wondering how the email will look to you here is an example below

*********** Request For Estimate ***************
Name: Nicole Rutter
Address: 11124 my street
City: Omaha
State: Nebraska
Zip Code: 68154
Phone Number: 402-222-2222
Alternate Phone Number: 402-111-1111
Best Time to Call: Morning
Email Address: nicole@cfwebtools.com

Services Requested:
Flex

Website URL: nicole.cfwebtools.com

Message: Reqesting some information for a flex project

Happy coding!

Posted At : December 6, 2007 8:06 AM | Posted By : Nicole Henningsen

Go Daddy ASP CDONTs form mail issue

Go Daddy ASP form mail issue.


I have a friend who currently has a website hosted through Go Daddy who was having form mail problems. He has had a Go Daddy account for a while now and all had been well until he decided to change his domain name. Turns out his old site was actually on an older Go Daddy server that supported CDONTS. Changing his domain name and transferring his information to his new domain placed it on a newer Go Daddy server.

ASP CDONTS has been used for quit some time and he did not expect a problem when switching domains. It was pretty evident that once he moved his site that his form mail was no longer working. The code would not throw an error it would simply not send his form mail. After spending a few hours on the phone with go daddy support the only solution they were able to provide was to use there built in gdform.asp. After careful review of the code I decided there had to be a better way. If your hosting on a Go Daddy server now I highly recommend you use CDO.Message, and if you have existing CDONTS code, that you convert it to CDO.Message now, rather than waiting until you absolutely have to.

I searched several forums only to find out that there really wasn't a good solution out there for this issue. By this time my friend was getting pretty frustrated with Go Daddy and the support that they were providing. After trying a few different ways of sending ASP form mail I finally decided to use CDO.Message. At last it worked! I hope that this blog will save you hours and hours of testing and phone calls. I think my friend owes me one ;). After figuring out the solution to the problem I did attempt to contact Go Daddy for the old domains server IIS and SMTP configuration VS the new configuration but he was unable to provide that information =) hmmm go figure.

The only thing I can think of is the old server was still on IIS 5.0...CDONTS components where standard with IIS 5.0. Understanding that microsoft removed the component from IIS 5.1 on Windows XP I would have to assume there is not a copy of the cdonts.dll on the new IIS server. Why Go Daddy decided not to support CDONTs any more who knows?

Dim Mail
set Mail=server.createobject("CDO.Message")
Mail.From = test@yahoo.com
Mail.To= test@yahoo.com
Mail.Subject = Sending form mail with GoDaddy
Mail.TextBody = This is a test message to confirm that my message is being sent
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") =2
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="relay-hosting.secureserver.net"
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =25
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =1
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") =your email address
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =your email password

Mail.Configuration.Fields.Update
Mail.Send
set Mail=nothing

Still confused? Check out my latest post on this issue with a working example. http://nicole.cfwebtools.com/index.cfm/2008/2/1/Go-Daddy-ASP-CDONTs-form-mail-issue-CONTINUED




Blog provided and hosted by CF Webtools. Blog Sofware by Ray Camden.