# This mail code doesnt work in php4

**URL:** <https://forum.kirupa.com/t/this-mail-code-doesnt-work-in-php4/210658>\
**Category:** Uncategorized\
**Created:** [December 20, 2006, 7:33pm UTC](https://forum.kirupa.com/t/this-mail-code-doesnt-work-in-php4/210658 "2006-12-20T19:33:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rille31](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@rille31](https://forum.kirupa.com/u/rille31)\
**Post date:** [December 20, 2006, 7:33pm UTC](https://forum.kirupa.com/t/this-mail-code-doesnt-work-in-php4/210658/1 "2006-12-20T19:33:46Z")

</div>

Anybody have an idea why this code doesnt work on a domain with php4 installed but works on one with php5.  
Could it be a serversetting?

```php
function replace($text){
 $text = trim($text);
 $text = str_replace("Ã¥", "&aring;", $text);
 $text = str_replace("Ã&#8230;", "&Aring;", $text);
 $text = str_replace("Ã¤", "&auml;", $text);
 $text = str_replace("Ã&#8222;", "&Auml;", $text);
 $text = str_replace("Ã¶", "&ouml;", $text);
 $text = str_replace("Ã&#8211;", "&Ouml;", $text);
 return $text;
}
 
foreach($_POST as $key=>$value) {
    $temp = replace($value);
    $_POST[$key] = $temp;
 }
 
$Name = $_POST['name'];
$Email = $_POST['email'];
$Phone = $_POST['phone'];
$Foretag = $_POST['company'];
$ToComments = $_POST['message'];
$ToEmail = "my@email.com";
 
$ip = $_SERVER['REMOTE_ADDR']; 
 
$ToName = "Rick";
$ToSubject = "Email from my site";
 
$EmailBody = "Sent By: $Name
Senders Email: $Email
Senders Phone: $Phone
Senders Company: $Foretag
Message Sent: $ToComments
";
 
$EmailFooter="
This message was sent by: $Name from ipnumber $ip, If you feel that you recieved this email by accident please contact us at http://www.mysite.com";
 
$Message = $EmailBody.$EmailFooter;
 
$mailing = @mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$Name." <".$Email.">");
 
if($mailing==true){
  $something="&sent=OK&"; 
 echo $something; 
 }else{
  $something="&sent=FAILED&"; 
  echo $something;
}

```

The variabel $mailing returns true but the email is newer sent on one of the domains I tested it on(php4), on my own domain it works ok(php5).
