#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    28
    Rep Power
    0

    PHP on windows - problem with script


    Hi folks,

    Im just using this php code to send an email:

    <?
    function MailInfo($myemail){
    global $name,$email,$fon,$email,$theme;
    global $time,$date;
    if(trim("$name") == "")
    { //Verifying input
    echo "No name<BR>";
    }
    if(trim("$fon") == ""){ //Verifying input
    echo "No phone entered.<BR>";
    }
    else
    {
    //now we mail both recipients only if a name is entered
    $your_message = "
    Information:\n
    Name: $name
    E-Mail: $email
    Fon: $fon
    Theme: $theme
    PLZ-Ort: $time
    DATE: $date\n";

    //Make sure you replace this according to what you want
    //the thank you message to say

    echo "<B>Thanks </B>.";

    $thank_you_message = "
    Thank you!";

    $extra_headers = "From: $email";
    $extra_headers2 = "From: friend@service.ocm";


    mail("$myemail","!!! Kontaktformular !!!","$your_message","$extra_headers");
    //mail YOU the info
    mail("$email","your message","$thank_you_message","$extra_headers2");
    //mail thank you email
    } //closes if else
    }// closes function

    function ShowResults ($name) {
    MailInfo("sender@mail.com");//replace with your email
    } # End of function ShowResults

    // Define $data below with $variables you want to write.
    // (ex. - $data = $email_address, $name, $phone_number, etc.)
    // Make sure that the " " is surounding the variables.

    $data = " ";

    // You are saveing what is considered personal info, so name file w/ .php extention.
    // That way if called direct from browser, it will spill an error and not show the contents.

    $fhandle = fopen('path/to/file/log.php', "a");
    fwrite ( $fhandle, $data );
    fclose ( $fhandle );

    // Make sure that the data file is CHMOD to 666 to be writable.
    // Put this code at end of mail script.

    function ShowForm() {
    global $PHP_SELF;
    ?>

    This script works perfectly on linux, but not on windows.
    On loading the page you get this error for each variable:

    Notice: Undefined variable: name in C:\web\com\mail.php on line 66

    How do I have to modify the script that it sends the mails and writes the log?

    thanks,
    freeman
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    earth
    Posts
    364
    Rep Power
    13
    ive got the same problem in windows, i think the mail() is not supported on windows.
    ...
  4. #3
  5. // no comment
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2001
    Posts
    1,645
    Rep Power
    40
    you have to setup your own smtp server on windows for the mail script to run.
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    28
    Rep Power
    0
    how do we have to change the script to get it working with a smtp account - and how will the log file work?

IMN logo majestic logo threadwatch logo seochat tools logo