View Full Version : Godaddy compatible code to autoreply to form mailer email

01-18-2012, 05:14 PM
Hi everyone, Im new to PHP and I've been trying to get my head around some scripts.

Godaddy gives you a script called gdform.php for form mailers but the autoreply isnt set to reply to the email address given in the form. Instead I get an email loop. I'm not sure which changes I need to make to the HTML on my form page (contact.html) and the php. below are the contents of the Godaddy mailer form gdform.php:

$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
$t = date("U");

$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");


This is the HTML code form my form. I obvioulsy want the php code to tell the autoreply to go to the address in the 'mail' field

<form name="contact_form" method="post" action="/gdform.php" onSubmit="return evalid()">
<input type="hidden" name="redirect" value="thankyou.html" />
<table border="0"><tr>
<td>First Name *</td>
<td colspan="2"><input name="fname" type="text" size="30" /></td>
<td>Your E-mail *</td>
<td colspan="2"><input type="text" name="mail" size="30" /></td>
<td colspan="2"><input name="phone" type="text" size="30" onkeypress="return numere(event)" onkeyup="return limitarelungime(this, 10)" /></td>
<td>Subject *</td>
<td colspan="2"><input name="subject" type="text" size="30" /></td>
<td>Message *</td>
<td colspan="2"><textarea name="message" onkeyup="return limitarelungime(this, 500)" cols="35" rows="5"></textarea></td>
<td> </td>
<td colspan="2"> </td>
<td><input type="reset" name="reset" value="Reset"/></td>
<td align="right"><input type="submit" name="Submit" value="Submit"></td><td align="right"><a href="http://www.scriptgenerator.net/71/HTML%7B47%7DPHP-Contact-Form-Mailer-Generator/" title="Valid Contact Form"><img src="http://www.scriptgenerator.net/images/validform.jpg" alt="Valid Contact Form" width="20" height="20" border="0" /></a></td>

Hope this makes sense. thanks in advance!

01-19-2012, 08:56 AM
The script gdform.php and webformmailer.php will only send to the email address that you have set in your Hosting Control Center. You can check out http://support.godaddy.com/help/article/510?isc=SMFOR1 for more info on it. If you need additional flexibility, you are welcome to script your own mailer function as well. Hope this helps.

James R.