i suck at this - help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mutt
    Too lazy to set a custom title
    • Sep 2002
    • 34431

    #1

    i suck at this - help

    can anybody tell me why this little contact form isn't working for me? i get 'Mail Error' when I submit the form.


    PHP Code:
    <?
    
    
    $str="";
    $str= "Name:".$_POST['txt_name']."<br><br>"."Email: ".$_POST['txt_email']."<br><br>Subject: ".$_POST['txt_subject']."<br><br>Message: <br>".$_POST['txt_msg'];
    $to= '[email protected]' ;
    $subject="Free Consultation Form";
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: '.$email . "\r\n";
    $message =   $str;
    mail($to,$subject,$message,$headers) or die("Mail Error");
    
    
    if($_POST['chk_me']==1) {
        $to=  $_POST['txt_email'] ;
        $subject="Free Consultation Form";
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= 'From: '.$email . "\r\n";
        $message =   $str;
        mail($to,$subject,$message,$headers) or die("Mail Error");
        
    }
    
    header("Location:". $_SERVER['HTTP_REFERER']);
    
    ?>
    I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!
  • grumpy
    Too lazy to set a custom title
    • Jan 2002
    • 9870

    #2
    is mail enabled on your server?
    Don't let greediness blur your vision | You gotta let some shit slide
    icq - 441-456-888

    Comment

    • FlexxAeon
      Confirmed User
      • May 2003
      • 3765

      #3
      $headers .= 'From: '.$email . "\r\n";

      to

      $headers .= 'From: '.$_POST['txt_email'] . "\r\n";
      Last edited by FlexxAeon; 02-05-2012, 10:36 AM.
      flexx [dot] aeon [at] gmail

      Comment

      • Mutt
        Too lazy to set a custom title
        • Sep 2002
        • 34431

        #4
        Originally posted by grumpy
        is mail enabled on your server?
        well i sent in a ticket to the host 9 hours ago but no response - mainstream host, this isn't for an adult site.
        I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

        Comment

        • raymor
          Confirmed User
          • Oct 2002
          • 3745

          #5
          Originally posted by FlexxAeon
          $headers .= 'From: '.$email . "\r\n"; to
          $headers .= 'From: '.$_POST['txt_email'] . "\r\n";
          and note that you'll find yourself listed as a spammer at some point when the spambots find your form. For the "from" address they'll enter:

          [email protected]
          Cc: [email protected], [email protected], [email protected]...

          For the from address or anything else user submitted, use only the captured text from a proper regex match on valid input.
          For historical display only. This information is not current:
          support&#64;bettercgi.com ICQ 7208627
          Strongbox - The next generation in site security
          Throttlebox - The next generation in bandwidth control
          Clonebox - Backup and disaster recovery on steroids

          Comment

          • sixsax
            Confirmed User
            • Aug 2006
            • 213

            #6
            Sanitize dat inputz! http://php.net/manual/en/filter.filters.sanitize.php

            Comment

            • FlexxAeon
              Confirmed User
              • May 2003
              • 3765

              #7
              Originally posted by raymor
              and note that you'll find yourself listed as a spammer at some point when the spambots find your form. For the "from" address they'll enter:

              [email protected]
              Cc: [email protected], [email protected], [email protected]...

              For the from address or anything else user submitted, use only the captured text from a proper regex match on valid input.
              flexx [dot] aeon [at] gmail

              Comment

              • Mutt
                Too lazy to set a custom title
                • Sep 2002
                • 34431

                #8
                tried it on another server - works. this host must have mail blocked.

                i have no idea how to make the form spammer proof - it's a jquery mail form called SimpleModal that seems to be very popular.
                I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

                Comment

                • Deej
                  I make pixels work
                  • Jun 2005
                  • 24386

                  #9
                  I told you I do that day in and day out...

                  I must inadvertently pissed in your cheerios at one time or another...

                  Anyway, the bowl is kicking off. Hit me up if you need future help!

                  Deej's Designs n' What Not
                  Hit me up for Design, CSS & Photo Retouching


                  Icq#30096880

                  Comment

                  Working...