Page 1 of 1

This script works on some servers, but not others

Posted: Mon Aug 24, 2009 4:07 pm
by calisonder
Hi,


I'm not a coder but I have a simple PHP script that I always use in my contact forms on websites. I usually use godaddy servers which have PHP Version 5.2.5 installed and the script works fine.

Unfortunately, the site I am working on is hosted by yahoo and the PHP Version on their servers is Version 4.3.11. The script does not work on there servers, and PHP is enabled. I tested the website I am working on on my own Godaddy servers and the the form works fine, but once I upload it to the yahoo servers it does not work.

Is the code I'm using written in a newer version of PHP which won't allow it to work on Yahoo servers? Thats the only thing I can think of. If so, can someone give me some hints on how to modify the code to work on those yahoo servers.

Thanks to everyone in advance.

Code: Select all

 
 
<?php
/*
   Flash Mail Form
*/
// Create local PHP variables from the info the user gave in the Flash form
$senderName   = $_POST['userName'];
$senderEmail     = $_POST['userEmail'];
$senderPhone     = $_POST['userPhone'];
$senderAddress     = $_POST['userAddress'];
$senderMessage = $_POST['userMsg'];
 
 
 
// Strip slashes on the Local variables
$senderName   = stripslashes($senderName);
$senderEmail     = stripslashes($senderEmail);
$senderPhone     = stripslashes($senderPhone); 
$senderAddress     = stripslashes($senderAddress); 
$senderMessage   = stripslashes($senderMessage); 
 
 
    $to = "info@5twelvedesign.com";
    
    
     // Place sender Email address here
    $from = "$senderEmail ";
    $subject = "Contact from your site";
    //Begin HTML Email Message
    $message = <<<EOF
<html>
  <body bgcolor="#FFFFFF">
<b>Name</b> = $senderName<br /><br />
<b>Email</b> = <a href="mailto:$senderEmail">$senderEmail</a><br /><br />
<b>Phone Number</b> = $senderPhone<br /><br />
<b>Address</b> = $senderAddress<br /><br />
<b>Message</b> = $senderMessage<br />
  </body>
</html>
EOF;
   //end of message
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";
    $to = "$to";
 
    mail($to, $subject, $message, $headers);
    
exit();
?>
 
 

Re: This script works on some servers, but not others

Posted: Mon Aug 24, 2009 4:13 pm
by Darhazer
Works fine on PHP 4.4.9
What error you are receiving? Or it does not produce error, but does not send e-mail as well?

Re: This script works on some servers, but not others

Posted: Mon Aug 24, 2009 10:51 pm
by calisonder
No it does not produce an error, it just doesn't send the message on the yahoo server, but it does send the message on godaddy servers with the updated version of php.

Re: This script works on some servers, but not others

Posted: Tue Aug 25, 2009 8:22 am
by Darhazer
calisonder wrote:No it does not produce an error, it just doesn't send the message on the yahoo server, but it does send the message on godaddy servers with the updated version of php.
Probably the mail function is disabled on your yahoo hosting.
Try:

Code: Select all

$result = mail($to, $subject, $message, $headers);
var_dump($result);
 
to see if it accepts the mail at all