Using PHP on WinHost

Discussion in 'Site Programming, Development and Design' started by manlyboy, Feb 22, 2010.

  1. Hi,

    I have a simple php script that sends an email - works very well on my previous apache server.

    I need to use php as the application is intended to work predominently on apache servers. The script itself is :

      if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) { if ($_SERVER['REQUEST_METHOD']=="POST"){  
         // In testing, if you get an Bad referer error comment out or remove the next three lines  
         if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ||  
            !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))  
            die("Bad referer");  
         $msg="Values submitted by the user:\n";  
         foreach($_POST as $key => $val){  
            if (is_array($val)){  
               $msg.="Item: $key\n";  
               foreach($val as $v){  
                  $v = stripslashes($v);  
                  $msg.="   $v\n";  
         } else {  
           $val = stripslashes($val);  
           $msg.="$key: $val\n";  
       $recipient="[email protected]";  
       $subject="Web Booking Request";  
       if (mail($recipient, $subject, $msg)){  
          echo "<div id='thankyou'><h1>Thank you.</h1><p>We will confirm your booking via email shortly.</p>
          echo nl2br($input);  
       } else  
          echo "<div id='thankyou'><h1>An error occured and the booking cannot be made.</h1></div>";  
      } else  
         echo "<div id='thankyou'><h1>Bad request method. Please contact us for assistance.</div>";  
    } else { 
    echo "<div id='thankyou'><h1>You failed to enter the correct Security code. Please try again or contact us for assistance.</div>"; 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">  
    <html xmlns="">  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    <title>North Shore Tennis Club On-Line Booking System</title>  
    <style type="text/css"> 
    h1 {font-size: 18px;} 
    p {	font-size: 14px;	font-style: normal;} 
    #thankyou {	
    font-family: Verdana, Arial, Helvetica, sans-serif;
    background-color: #FFFF66;
    border: medium ridge #666666;
    position: relative;
    height: 100px;
    width: 300px;
    top: 10px;
    right: 10px;
    margin: 20px;
    padding: 20px;}
    Calling the script results in the code displaying it's error message.

    What do I need do to have this script execute from a directory on my Winhost server? I have declared the directory an 'Application Starting Point' but that's all I know what to do.
    Last edited by a moderator: Oct 14, 2015
  2. Ray


    Unfortunately sending mail through PHP is not supported on our Shared Windows hosting platform. The problem is the method in which mail() works and how our SMTP server requires SMTP authentication. mail() doesn't have the ability to pass SMTP authencation. Typically users hat use mail() in PHP rely on the mail server to allow open relay. This means no smtp authentication. But to help fight and ward off spam it is common practice to enable smtp authentication. For PHP to send off email with smtp authentication PEAR must be enabled on the server. And I'm afraid PEAR is not enable on our Windows server.

Share This Page