# PHP Email Form workin on 1 site not on the other?

**URL:** <https://forum.kirupa.com/t/php-email-form-workin-on-1-site-not-on-the-other/218173>\
**Category:** programming\
**Created:** [March 5, 2007, 5:53pm UTC](https://forum.kirupa.com/t/php-email-form-workin-on-1-site-not-on-the-other/218173 "2007-03-05T17:53:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jezthomp](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Jezthomp](https://forum.kirupa.com/u/Jezthomp)\
**Post date:** [March 5, 2007, 5:53pm UTC](https://forum.kirupa.com/t/php-email-form-workin-on-1-site-not-on-the-other/218173/1 "2007-03-05T17:53:02Z")

</div>

I have the following form

```auto
<div id="emailContainer">
<?php
ini_set("sendmail_from", "mailserver@ ********.co.uk");
if ($_POST["Submit"]) {
// if we dont have all the info we want then we will output an error message
if ((!$_POST["name"]) OR (!$_POST["email"])) {
// We do not have all the info we need so output error
print "<br>You have not given us all the information we need to process the form.<br>";
print "Please use the browser back and/or refresh button to go back and edit the form.";
}else{
// We have the info we need so lets send the info in an email
$recipient = "Website Enquiry <test@test.net>"; 
$subject = "Evacuee Website Enquiry Form"; 
// Lets get all the info from the form and so we can send it in the email
$name = $_POST["name"];
$telNum = $_POST["telNum"];
$email = $_POST["email"];
$comments = $_POST["comments"];

$message = "WEBSITE CONTACT FORM:
____________________________________________
Contact Info:

Name: $name

E-Mail Address: $email

Contact No: $telNum

____________________________________________
Comments:

Comments: $comments

"; 

$extra = "From: $name <$email>"; 
// actually send the mail 
mail ($recipient, $subject, $message, $extra); 
// Print thank you message
			
print "Many Thanks $name! for contacting us, we shall get back to you as soon as possible...";
}
} else { ?>
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post" name="form1">
<fieldset>
<legend>Please fill out the form below for any further enquiries. TESTING </legend>
<div class="field">
<label for="name">Name: <span class="required">*</span></label>
<input class="text" id="name" maxlength="64" name="name" size="24"type="text"/>
</div>
<div class="field">
<label for="email">Email Address: <span class="required">*</span></label>
<input class="text" id="email" name="email" size="32"type="text"/>
</div>
<div class="field">
<label for="telNum"><span>Tel No:</span></label>
<input name="telNum" class="text" id="telNum"size="32" type="text"/>
</div>

<div class="field">
<label for="comments"><span>Comments:</span></label>
<textarea name="comments" cols="31" rows="5" class="text" id="comments"></textarea>
</div>
<div class="field">
<input name="Submit" type="submit" class="submit" value="Submit" />
</div>
</fieldset>
<div></div>
</form>
<?php } ?> 
</div>

```

Now it works on this site [phpinfo](http://www.evacueesreunion.co.uk/phpinfo.php) which has PHP Version 4.3.2 on it

However, i am using the same form on another site and its not working[phpinfo](http://www.rawliquidmedia.co.uk/newsite/wedding/phpinfo.php) which has PHP Version 4.4.4 on it.

The form sends ok and you get the confirmation line but the email is not delivered.

I have been scratching my head over this one for a while, any ideas anyone?

Many thanks 🙂
