Tag Archive for 'websites'

How to create a contact form on a GoDaddy hosting account

Let me start by saying I hate GoDaddy. Their customer service sucks, you get little to no useful help. Their user interface sucks, it’s ad-laden and not user-friendly. And today I’ve learned their hosting environment sucks too.

Also let me lay down this disclaimer: I’m not a website designer. I can do simple HTML, simple image manipulation, I know just enough to be dangerous about ASP and PHP (and that’s not much), and I can create easy-to-use and functional websites.

If you’re unfortunate enough to be a GoDaddy customer, you may have encountered this issue. I created a simple ASP contact form to use on a site I was designing for a friend. It’s very simple — just a name, email address, and text area for comments. No required fields. I’ve used this form in the past with no problems. Alas, it didn’t work. With the internet at my fingertips, I encountered various other people with this problem, and not just because something was wrong with the code, but because GoDaddy uses CDO.Message rather than CDONTS. Not only that, but you also need the SMTP server information in order to use it, which they don’t publicly address anywhere.

GoDaddy support says to use their own special gdform.asp (or gdform.php depending on your package), which also seems to require you “activate” it using your hosting control panel. I didn’t have access to this (I only had FTP access) so I had to find an alternative.

Finally, with the help of this post, I was able get it working. I modified the code slightly to redirect to a thank you page.

Use the code below to create your own. Copy the code into your contact.htm (or whatever you’re using) and customize the form, copy the code for the contact.asp page and modify the redirect (or remove it if you like) to the page you’d like to send them to after the form is submitted.

Contact.htm

<form name=”email” action=”contact.asp” method=post>
<p>Name:<br />
<input type=”text” name=”name” size=”25″ /></p>
<p>Email address:<br />
<input type=”text” name=”name” size=”25″ /></p>
<p>Questions, comments?<br />
<textarea rows=”10″ cols=”60″ name=”comments”></textarea></p>
<input type=”submit” value=”Send” /></p>
</form>

Contact.asp

<% @ Language=”VBSCRIPT” %>

<% If Request.ServerVariables(”REQUEST_METHOD”) = “POST” Then
‘*
‘* Send Email
‘*
Dim strBOD
strBOD = “Name: ” & Request.Form(”name”) & vbCrLf _
& “Email: ” & Request.Form(”email”) & vbCrLf & vbCrLf _
& Request.Form(”comments”)
Dim objCFG
Set objCFG = Server.CreateObject(”CDO.Configuration”)
objCFG.Fields.Item(aCDO & “sendusing”) = 2
objCFG.Fields.Item(aCDO & “smtpserver”) = “relay-hosting.secureserver.net
objCFG.Fields.Item(aCDO & “smtpserverport”) = 25
objCFG.Fields.Update
Dim objCDO
Set objCDO = Server.CreateObject(”CDO.Message”)
objCDO.Configuration = objCFG
objCDO.From = Request.Form(”email”)
objCDO.To = “inquiries@yourwebsitehere.ca
objCDO.Subject = “Website inquiry
objCDO.TextBody = strBOD
objCDO.Send
Response.Redirect “thanks.shtml
Set objCDO = Nothing
Set objCFG = Nothing
End If

%>