ASP contact form for use on GoDaddy sites
July 15, 2009
Most Popular | ASP | Web Building
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.


Ads by Google

Posted by ellen at July 15, 2009 11:21 AM
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.
Ads by Google

5 Comments

I tried the 2nd set of codes which included a formproc.asp and contact.htm

http://thedesignspace.net/MT2archives/000655.html

I copy the codes over and replace only my email address .To

it doesn't work...do u have an updated one?

Hi,

I have a dilema trying to implement the GoDaddy ContactUs page in ASP.NET using the _gdForm/webformmailer.asp file.

Under GoDaddy Account Management:
Hosting.Content.Form Mailer
1. I have setup the Form-mailer email address that must be setup
2. I have set the checkbox to reinstate the _gdForm directory contents (not viewable by FTP)

I use ASP.NET master pages which already contain a declaration:

....

My Contact.aspx page derives from this masterpage

and as you CANNOT nest declaratons

How then can I integrate the GoDaddy form-mailer

<form action="http://www.earthed.net.au/_gdForm/webformmailer.asp" method="POST">
.....
</form>

Must I integrate the two <form> declarations into one?

I am pretty new to ASP.NET.

Any help would be appreciated.

Thank you very much for your assistance, I was down to my last nerve and going nutz.

Hi,

I came here hoping to find code to avoid the reply address munging you mentioned. I have a couple of questions, one is I think there is a typo in the form code, you use action="form_ac.asp" instead of using the form code you posted, "formproc.asp".

Also I'm getting an error on the line that contains the .Send command (that's all that's on that line).

error '8004020e'
/formproc.asp, line 59

Do you have any suggestions?

Thank You,
Mike

Thanks!


Ads by Google

 RSS   |   Contact Me


Ads by Google