# Problems with php contact form

**URL:** https://forum.kirupa.com/t/problems-with-php-contact-form/301133
**Category:** Uncategorized
**Created:** [December 3, 2009, 7:33pm UTC](https://forum.kirupa.com/t/problems-with-php-contact-form/301133 "2009-12-03T19:33:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bonder](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@bonder](https://forum.kirupa.com/u/bonder)
#### Post date: [December 3, 2009, 7:33pm UTC](https://forum.kirupa.com/t/problems-with-php-contact-form/301133/1 "2009-12-03T19:33:08Z")

</div>

Hey all,

I am trying to get down to the bottom of my problem with a contact form I’m using for a client. My code is as follows:

\<?php  
$contact\_name = $\_POST[‘name’];  
$contact\_email = $\_POST[‘email’];  
$contact\_subject = $\_POST[‘subject’];  
$contact\_message = $\_POST[‘message’];

if( $contact\_name == true )  
{  
$sender = $contact\_email;  
//Put your email below  
$receiver = "info@valleyhomemovies.com";

```
$email_body = "Name: $contact_name 

```

Email: $sender

Subject: $contact\_subject

Message:

$contact\_message";   
$extra = "From: $sender  
" . "Reply-To: $sender  
" . “X-Mailer: PHP/” . phpversion();

```
if( mail( $receiver, "valleyhomemovies.com Contact Form - $contact_subject", $email_body, $extra ) ) 
{
	echo "success=yes";
}
else
{
	echo "success=no";
}

```

}  
?\>

The issue I’m having is that when I hit the submit button on my form, it doesn’t send the information through. It just stays stuck on sending… and doesn’t send any information. I then ran a test with an even simpler code:

\<?php  
mail(‘info@valleyhomemovies.com’,‘Test mail’,‘The mail function is working!’);  
echo ‘Mail sent!’;  
?\>

Just to see if it was even connecting and I recieved this error:

Warning: mail() [function.mail]: Failed to connect to mailserver at “127.0.0.1” port 25, verify your “SMTP” and “smtp\_port” setting in php.ini or use ini\_set() in D:\hosting\member\shield\vhm\mailtest.php on line 2

Now I don’t have access to the host server because I’m not the owner. I just designed the site for the client and I have been having these issues with the form. I did test it on my server and everything worked fine which led me to believe that the problem lies in the php settings of their host server. I contacted the host server and this is what they sent me:

\*"Dear client, 127.0.0.1 is localhost which you cannot use to send email. Please make use of your mail server to and send and provide SMTP authentication to the remote server. Note that the FROM address has to be the same as login email.

You can find sample mail scripts at [http://webhost4life.com/HostingKB/Kn…icle50140.aspx and [URL=“http://webhost4life.com/HostingKB/KnowledgebaseArticle50203.aspx”]http://webhost4life.com/HostingKB/Kn…icle50203.aspx](http://webhost4life.com/HostingKB/KnowledgebaseArticle50140.aspx)  
\*
