PHP Mail Form Script Won't Work on GoDaddy

I made this PHP mail form script about five years ago. I hardly know any PHP, and I’ve just been reusing this over the years. The script seems to work on other servers, but not on GoDaddy. I’ve used this script on the same GoDaddy account several years ago, so I don’t know if there is some kind of PHP incompatibility or something which is affecting it. Here’s the link where the form is: [Admin: link removed for security reason]

I’ve called up GoDaddy several times and they don’t seem to be any help. They just keep directing me towards their own mail form script, which I don’t want to use.

Here’s the source of the script:


// Form Variables
$name = $_REQUEST [‘name’];
$email = $_REQUEST [‘email’];
$address = $_REQUEST [‘address’];
$state = $_REQUEST [‘state’];
$zip = $_REQUEST [‘zip’];
$state = $_REQUEST [‘state’];
$contact = $_REQUEST [‘contact’];
$time = $_REQUEST [‘time’];
$phone = $_REQUEST [‘phone’];
$plate = $_REQUEST [‘plate’];
$business = $_REQUEST [‘business’];
$describe = $_REQUEST [‘describe’];
$notes = $_REQUEST [‘notes’];

// Recipients

//$to .= ‘[email protected]’ . ', ';
//$to .= ‘[email protected]’ . ', ';
$to .= ‘[email protected]’;

mail( “$to”, “Automobile Quote”,

stripslashes("Name: $name \nMailing Address: $address \nState: $state \nZIP/Postal Code: $zip \nBest Way to Contact: $contact \nPrimary Phone Number: $phone \nBest time to contact: $time \nPlate: $plate \nIs the vehicle used in business?: $business \nIf so, please describe: $describe\nNotes: $notes"), "From: $email");

header( “Location: ./autoquote.php” );
header( “Cache-Control: no-cache, must-revalidate” );
header( “Pragma: no-cache” );


There is security leak in your script, therefore I have removed link to your form. You need to sanitize form input before sending this info by email. Particularly, you need to escape any new line chars from the email field (which you use in email header), as this is often used by spammers.

What do you mean by: script not working on Godaddy? What error message do you receive, what is in the error log? I see you are using short php tags <? which is deprecated, and depending on setting in your php.ini this will or will not work. I recommend to use full tag <?php

Also I see you apply stripslashes() to message, this means you rely on php setting magic_quotes_gpc = On.
If this is Off in your hosting configuration, this operation will just replace new lines in your code \n to just n.

Apologies for the link. I know next to no PHP and so I’m just not aware of how vulnerable this thing is, or how to fix it.

When I mean the script isn’t working on GoDaddy, I mean it works with some hosts, but not others. The script doesn’t spit out an error, and nothing shows up in the error logs. When you fill out the form and click submit, you’re supposed to be sent to the script, which emails the form data, and then sends you back to the original page. What actually happens is that the viewer gets sent to the script, the email doesn’t get sent, and the viewer is not redirected to the original page.

I did manage to get the script to work once on GoDaddy. The only difference in the configuration was the recipient list, but I have been unable to recreate this scenario.

Sponsor our Newsletter | Privacy Policy | Terms of Service