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?
function replace($text){
$text = trim($text);
$text = str_replace("Ã¥", "å", $text);
$text = str_replace("Ã…", "Å", $text);
$text = str_replace("ä", "ä", $text);
$text = str_replace("Ä", "Ä", $text);
$text = str_replace("ö", "ö", $text);
$text = str_replace("Ö", "Ö", $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).