Closed Thread
Results 1 to 2 of 2

Thread: Php script for mail doens't work anymore

  1. #1
    messa is offline x10Hosting Member messa is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    12

    Php script for mail doens't work anymore

    Hello,

    I use since a few months a contact form made in Flash with a php script to send me mail, now since a couple of days (could be longer) it doesn't work anymore.
    When I use this test script, that works fine
    <?
    mail("emailadres@myprovider.com","test","OK it works");
    ?>

    When I use my script, it doesn't

    <?
    if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name']))
    {
    $to = "myemail@myprovider.com";
    $subject = stripslashes($HTTP_POST_VARS['sender_subject']);
    $body = stripslashes($HTTP_POST_VARS['sender_message']);
    $body .= "\n\n---------------------------\n";
    $body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
    $header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
    $header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
    $header .= "X-Mailer: PHP/" . phpversion() . "\n";
    $header .= "X-Priority: 1";
    if(@mail($to, $subject, $body, $header))
    {
    echo "output=sent";
    } else {
    echo "output=error";
    }
    } else {
    echo "output=error";
    }
    ?>

    Ofcourse the email adresse in my script are correct, I just taken them out...
    On my local webserver it all works fine...
    Can someone help me locate the source of this problem.
    something changed on the webservers ?

    Thanks for the help

    messa

  2. #2
    smmalis37 is offline x10Hosting Member smmalis37 is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    18

    Re: Php script for mail doens't work anymore

    Are you on advanced php? Beginner doesn't support the mail function. Also, the big if at the beginning should probably have the ors changed to ands. But the big one i think is that $HTTP_POST_VARS needs to be changed to just $_POST. Try those.

Closed Thread

Similar Threads

  1. Places to learn php
    By JaWasabi in forum Scripts & 3rd Party Apps
    Replies: 9
    Last Post: 01-13-2009, 02:03 AM
  2. Problem With PHP Script
    By xevell in forum Programming Help
    Replies: 1
    Last Post: 07-23-2008, 03:41 AM
  3. PHP Photo browser and x-fading slideshow script...
    By unmanaged in forum Scripts & 3rd Party Apps
    Replies: 0
    Last Post: 02-21-2008, 05:46 PM
  4. RSS to HTML PHP Script (FREE)
    By unmanaged in forum Scripts & 3rd Party Apps
    Replies: 6
    Last Post: 02-21-2008, 04:44 PM
  5. Creating MySql database/table using php script
    By bushimports in forum Free Hosting
    Replies: 1
    Last Post: 02-02-2008, 12:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers