ASP contact form for use on GoDaddy sites

UPDATE

The form described below works, but if the user’s email address is from hotmail, yahoo or gmail, GoDaddy will still block submission of the form. So here is the solution:

Make the following changes.

  1. You will no longer need “formproc.asp”. GoDaddy will not release the code for their working form but you can use theirs.
  2. In contact.htm, replace everything within the FORM tags with the following HTML code. This sends the user’s data to GoDaddy’s ASP form processor, _gdForm/webformmailer.asp

    <form action="_gdForm/webformmailer.asp" method="post" id="form"> <input type="hidden" name="subject" value=&quot;Submission" /> <input type="hidden" name="redirect" value=&quot;thankyou.htm" /> <table cellpadding="0" cellspacing="0" summary="Contact form"> <tr> <th><label for="name">* Full Name: </label></th> <td><input type="text" name="name" id="name" size="25" maxlength="255" /></td> </tr> <tr> <th><label for="email">* Email Address: </label></th> <td><input type="text" name="email" id="email" size="25" maxlength="255" /></td> </tr> <tr> <th><label for="subject">Subject: </label></th> <td><input type="text" name="subject" id="subject" size="38" maxlength="75" /></td> </tr> <tr> <th><label for="message">Message: </label></th> <td><textarea cols="30" rows="6" name="message" id="message"></textarea></td> </tr> <tr> <td colspan="2" id="button"><input type="submit" value="Send Email" /></td> </tr> </table> </form>

  3. Next, create a “thankyou.htm” page, which can contain any message you want. This is going to be the page they get redirected to after the form has been processed.

GoDaddy made some changes to their smtp email server settings such that old ASP mail forms no longer work.

This is apparently an attempt to prevent spam from people using the server as a relay server, since the error that occurs is:

Final-Recipient: rfc822;yourname@yourdomain.com
Action: failed
Status: 5.5.0
Diagnostic-Code: smtp;553 sorry, your mail was administratively denied. (#5.7.1)

For some reason they have not updated their help site, and are unwilling to give examples of the corrected code.

Here is an example of a contact form that does work. You need two files, the contact form (contact.htm) and the ASP form processor page (formproc.asp)

contact.htm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>page title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>


<b> Contact</b>

<p>* Indicates required fields</p>
<form action="form_ac.asp" method="post" id="form">
<table cellpadding="0" cellspacing="0" summary="Contact form">
<tr>
<th><label for="name">*  Full Name: </label></th>
<td><input type="text" name="name" id="name" size="25" maxlength="255" /></td>
</tr>
<tr>
<th><label for="email">*  Email Address: </label></th>
<td><input type="text" name="email" id="email" size="25" maxlength="255" /></td>
</tr>
<tr>
<th><label for="subject">Subject: </label></th>
<td><input type="text" name="subject" id="subject" size="38" maxlength="75" /></td>
</tr>
<tr>
<th><label for="message">Message: </label></th>
<td><textarea cols="30" rows="6" name="message" id="message"></textarea></td>
</tr>
<tr>
<td colspan="2" id="button"><input type="submit" value="Send Email" /></td>
</tr>
</table>
</form>

</body>
</html>

formproc.asp

<%@ Language="VBscript" %> <% Option Explicit %>

<html> <head> <title>Page title goes here</title> <% Const cdoSendUsingMethod = _ "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSendUsingPort = 2 Const cdoSMTPServer = _ "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort = _ "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const cdoSMTPConnectionTimeout = _ "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" 'Const cdoSMTPAuthenticate = _ (not needed for godaddy) '"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" 'Const cdoBasic = 1 'Const cdoSendUserName = _ (not needed for godaddy) '"http://schemas.microsoft.com/cdo/configuration/sendusername" 'Const cdoSendPassword = _ (not needed for godaddy) '"http://schemas.microsoft.com/cdo/configuration/sendpassword"

Dim objConfig ' As CDO.Configuration Dim objMessage ' As CDO.Message Dim Fields ' As ADODB.Fields Dim name, email, subject, message name=request.form("name") email=request.form("email") subject=request.form("subject") message=request.form("message")

Set objConfig = Server.CreateObject("CDO.Configuration") Set Fields = objConfig.Fields

With Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "relay-hosting.secureserver.net" .Item(cdoSMTPServerPort) = 25 .Item(cdoSMTPConnectionTimeout) = 10 '.Item(cdoSMTPAuthenticate) = cdoBasic (not needed for godaddy) '.Item(cdoSendUserName) = "username" (not needed for godaddy) '.Item(cdoSendPassword) = "password" (not needed for godaddy)

.Update End With

Set objMessage = Server.CreateObject("CDO.Message") Set objMessage.Configuration = objConfig

With objMessage '.MailFormat = 0 .To = "Your name <youremailaddress@anydomain.com>" .From = email .Subject = "A standardized subject line can go here :: " & subject .HTMLBody = "Name entered: " & name & _ "<br>Email address entered: " & email & _ "<br>Message entered: " & message .Send End With Set Fields = Nothing Set objMessage = Nothing Set objConfig = Nothing %>

</head>

<body>

<h3 class="header">Thank you!</h3> <p id="sent">your request has been sent</p> </body> </html>

Thanks to John Peterson for the code that made this possible.