PHP Problems - Sending Mail from Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tonyb68
    New Member
    • Sep 2008
    • 2

    PHP Problems - Sending Mail from Form

    Hi - Not sure if this is exactly the right forum to enter this is - but need to start somewhere as I don't know where it's not working.

    I have a contact form on a flash website, when the submit button is pressed, another window opens to say the mail has been sent - when it hasn't (Ihave changed this to read there was a problem). I can't see anything in the logfiles to say what hasn't worked - but it's driving me crazy. The file called upon is contact.php which is why I'm here;

    [code=php]
    <?
    Error_Reporting (E_ALL & ~E_NOTICE);

    while ($request = current($_REQUE ST)) {
    if (key($_REQUEST) !='recipient') {
    $pre_array=spli t ("&777&", $request);
    $post_vars[key($_REQUEST)][0]=$pre_array[0];
    $post_vars[key($_REQUEST)][1]=$pre_array[1];
    }
    next($_REQUEST) ;
    }



    reset($post_var s);

    $sendTo ="Web@email.co. uk" ;
    $subject="From ".$post_var s['your_name'][0] ;
    $headers="From: ".$post_var s['your_email'][0] ."\n";
    $headers.='Cont ent-type: text/html; charset=iso-8859-1';
    $message='';
    while ($mess = current($post_v ars)) {
    if ((key($post_var s)!="i") && (key($post_vars )!="your_email" ) && (key($post_vars )!="your_name") ) {

    $message.="<str ong>".$mess[1]."</strong>&nbsp;&n bsp;&nbsp;".$me ss[0]."<br>";
    }
    next($post_vars );
    }

    mail($sendTo, $subject, $message. $headers);
    echo ("There was a problem sending the email - sorry for the inconvenience") ;

    ?>
    [/code]
    Code:
    <script>
    	resizeTo(450, 300);
    </script>
    Can anyone help? Do you need anymore information?

    Thanks
    TB
    Last edited by Markus; Sep 28 '08, 10:52 PM. Reason: added [code] tags
  • dlynx
    New Member
    • Oct 2008
    • 3

    #2
    Not too sure, but your code looks wrong, the error message should fire all the time successful or otherwise. In any case, the built-in mail function is not really a very good sender.

    <removed advertising>

    Comment

    • maheswaran
      New Member
      • Mar 2007
      • 190

      #3
      Not sure..may u try with
      [code=php]
      if(! mail($sendTo, $subject, $message. $headers))
      {
      echo ("There was a problem sending the email - sorry for the inconvenience") ;
      }
      [/php]

      Comment

      • tonyb68
        New Member
        • Sep 2008
        • 2

        #4
        The error message does come up all the time- I changed the text as it used to say "thanks - your mail has been sent succesfully" - when it hadn't.

        The problem is the message does not send or I don't get it - and I've got no idea how to make it work - happy to have it saying thanks - your mail has been sent succesfully" when I know it's going to get to me.

        Comment

        Working...