Web Design Forums

Welcome! Please register or log in: Forgot your password? Why register?
You are here: Web Design Forums » Programming Help » PHP » PHP Contact Form Issue RSS

PHP Contact Form Issue

This thread was started by mich5blue and has been viewed 488 times, and contains 8 replies, with the last reply made by mlseim.
Post Reply
1
View mich5blue's reputation
Posted January 29 '10 at 02:51 PM
      Posts: 4
I was wondering if anyone could help me with this issue I am having.

I have used a PHP contact form script successfully with every previous site I have worked on...until I had to use godaddy for my latest work.

Has anyone else had this kind of issue with godaddy not being able to support PHP contact form scripts, or possibly know of a work-around or fix for this?

Thanks for any info or help in advance.

Advertisement Register for free to hide these ads and participate in discussions!

2
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted January 29 '10 at 04:25 PM
      Posts: 3,100
GoDaddy can send emails just like anyone else ... BUT, here's the catch ...

It will only send emails to the email address in the webhost account.

You can't specify any other email addresses unless you go into the account profile
and change it to something else. http://help.godaddy.com/article/508

So, try a PHP email script, and use the email address in your account profile, see if it works.
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

3
View mich5blue's reputation
Posted January 29 '10 at 04:51 PM
      Posts: 4
Thanks for the reply! I just tried that, and it does not work after updating. So either is will take godaddy a little bit to adjust, or I still have something I need to do. Could there be anything else that could be not allowing this?

Thanks again for the suggestion, hopefully it works soon!

4
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted January 29 '10 at 05:37 PM
      Posts: 3,100
Try this simple script ...

<?php

// Put your Godaddy account email address here:
$recipient "info@mysite.com";

$subject "This is an email test";

$sender "nobody@aol.com";
$fmessage "This is a test of my email";

$message "

Email Test
---------------------------------------------------

$fmessage

---------------------------------------------------
"
;

$extraheaders "From: $sender\nReply-To: $sender\n\n";

if (! 
mail($recipient$subject$message$extraheaders)){
echo 
"Mail did not send for some reason.";
}
else{
echo 
"Email Sent";
}
?>

EDIT:
Also check your filtered junk-box ... it may have ended-up in there.



.
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

5
1 points at 100%
Posted January 29 '10 at 05:46 PM
      Posts: 39
I think you have to make sure Its Enabled.

Go to your Hosting Account
Manage Account
Content
Form Mail
Check Box for Install
If you already have it, then it will say "Reinstall Default Scripts Directory"
I had the same Problem and when I did that, it was ok.

6
View mich5blue's reputation
Posted January 29 '10 at 06:04 PM
      Posts: 4
Thanks for the reply guys, still cannot seem to get it to work.

Here is the PHP script I am using. (Sorry don't know how to format post for code yet)


<?php

if(!$_POST) exit;

$email = $_POST['email'];


//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','email','message');
$required = array('name','email','message');

$your_email = "HARApad@gmail.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\n";

foreach($values as $key => $value){
if(in_array($value,$required)){
if ($key != 'subject' && $key != 'company') {
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
}
$email_content .= $value.': '.$_POST[$value]."\n";
}
}

if(@mail($your_email,$email_subject,$email_content)) {
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>

7
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted January 29 '10 at 07:25 PM
      Posts: 3,100
Mich,
What version of PHP are you using (with Godaddy)?
... it should be PHP5, not PHP4.

Did you try using Godaddy's own "gdform.php"?
http://help.godaddy.com/article/510#gdform

Did you specify an email address for the PHP Form-Mailer?

Did you look on GoDaddy's FAQ pages for answers?
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

8
View mich5blue's reputation
Posted January 29 '10 at 08:23 PM
      Posts: 4
I actually have no idea. I do not work with Godaddy at all basically so I have no clue. Is there an easy way to check from the account settings?

Yea I looked around in their FAQs. I could get one of their simple ones to work, but I would like to get this one to work if possible.

Thanks.

[Edit] I am an idiot, the language version is set to ASP.net not PHP. It doesn't look like there is a way to switch it either.
Last edited January 29 '10 at 08:30 PM by mich5blue. Reply

9
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted January 30 '10 at 12:03 AM
      Posts: 3,100
doh! That explains it.

That means they are hosted on a Windows Server, not UNIX/Linux.
When they sign-up, they have the choice of which to use.
I think it can be switched. The site owner has to contact them and request it.
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

Post Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Top 21 PHP Programming mistakes thexchord PHP 18 March 10 '10 09:52 AM
Picking up a users IP address in my PHP contact form? ItalianMike PHP 1 February 6 '09 02:05 PM
PHP Contact Form Help! Please! msm446 PHP 3 January 17 '09 01:41 PM
PHP Contact Form Email Verification Abstract PHP 4 October 27 '08 10:57 PM
Basic PHP Uploads Tutorial thexchord Coding Articles & Tutorials 2 May 2 '02 09:28 PM