Results 1 to 5 of 5

Thread: Simple php script not working

  1. #1
    Join Date
    Apr 2007
    Posts
    2

    Default Simple php script not working

    This code is being called from a flash form. It doesn't work on this server, but it works on a different server, how come? Please help, thanks.

    PHP Code:
    <?php
     
       $to 
    "myemail@myserver.com";
       
    $msg "Name: $name\n\n";
       
    $msg .= "Email: $email\n\n";
       
    $msg .= "Phone: $phone\n\n";
       
    $msg .= "Location: $location\n\n";
       
    $msg .= "Comment:\n $message\n\n";

      
    mail($to$subject$msg"From: $email\nReply-To: $email\n");

    ?>

  2. #2
    Join Date
    Feb 2006
    Location
    Somewhere where I don't know where I am
    Posts
    2,155

    Default

    the from email has to actually exist in cPanel.
    Sign Up Now!
    Unlimited Storage, Unlimited Transfer, Host Unlimited domain names, 1 Free Domain Name
    BlueHost Features | BlueHost Help Desk | Become a BlueHost Affiliate | BlueHost CEO Blog
    (888) 401-4678 | Create a support ticket

  3. #3
    Join Date
    Apr 2007
    Posts
    2

    Default

    what do you mean exist in cpanel? the from email being parsed is the user's email he's inputting in the flash form? If you're referring to the "to" email being myemail@myserver, I changed that particularly for this topic just to not post my private email.

  4. #4
    Join Date
    Feb 2006
    Location
    Somewhere where I don't know where I am
    Posts
    2,155

    Default

    I mean exactly what I said. The from email has to be from an email off of your account. The reply to address can be the users email address or just include his email address in the message so you know who it was from.
    Sign Up Now!
    Unlimited Storage, Unlimited Transfer, Host Unlimited domain names, 1 Free Domain Name
    BlueHost Features | BlueHost Help Desk | Become a BlueHost Affiliate | BlueHost CEO Blog
    (888) 401-4678 | Create a support ticket

  5. #5

    Default

    Code:
    <?php
    $to      = ‘user@domain.com’;
    $subject = ‘Subject’;
    $message = ‘This is a test’;
    $headers = ‘From: webmaster@yourdot.com’ . “rn” .
       ‘Reply-To: webmaster@yourdot.com’ . “rn” .
       ‘X-Mailer: PHP/’ . phpversion();
    
    mail($to, $subject, $message, $headers);
    ?>
    The $headers string would modified to be inputted by sender.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •