Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I get fatal mail error after PHP upgrade

    Hi again

    Now, upgraded to PHP2.2 I get all of a sudden a fatal mail error. Strange thing is, though ... All mail still get sent

    It's a referral form. the form sends;
    1. a notice to administrator displaying the referrer and the referral email addresses
    2. a thank you letter to the referrer
    3. an invitation letter to the invitees


    here is the code I use
    PHP Code:
    <?php

      
    if ($_SERVER['REQUEST_METHOD'] != 'POST'){
        
    header('Refresh: 0; URL=/index.html');
        exit;
      }

      
    $mailto  "<me@my.com>";
      
    $subject "Tell a Friend Form from Survey";
      
    $message "Values submitted from the Tell a Friend form:";
      
    $ack_subject  "Thank You"
      
    $ack_message  "Thank you.\n"
      
    $ack_message .= "Please.\n";
      
    $ack_message .= "\n";
      
    $ack_message .= "Are you!\n";
      
    $ack_message .= "\n";
      
    $ack_message .= "url";
      
    $ack_message .= "\n";
      
    $ack_message .= "To.\n";
      
    $ack_message .= "\n";
      
    $ack_message .= "url";
      
    $ack_message .= "\n";
      
    $ack_message .= "Enjoy.\n";
      
    $ack_message .= "\n";
      
    $ack_subject2  "Business"
      
    $ack_message2 .= Valid_Input($_POST['txtMessage']);
      
    $ack_message2 .= "\n";
      
    $ack_message2 .= "url";
      
    $ack_message2 .= "\n";
      
    $name    Valid_Input($_POST['Email']);
      
    $email = !empty($_POST['Email']) && valid_email($_POST['Email']) ? $_POST['Email'] : $mailto
      foreach (
    $_POST as $key => $value){
        if (!
    is_array($value)){
          
    $message .= "\n".$key." : ".$value;
        }
        else{
          foreach (
    $_POST[$key] as $itemvalue){
            
    $message .= "\n".$key." : ".$itemvalue;
          }
        }
      }
      
    $header1  "From: ".$name." <".$Email.">\n";
      
    $header1 .= "Reply-To: ".$Email."\n";
      
    $header2  "From: ".$mailto."\n"
      
    $header2 .= "Reply-To: ".$mailto."\n";
      
    $header .= "MIME-Version: 1.0\n";
      
    $header .= "Content-Type: text/plain; charset=utf-8\n";
      
    $header .= "Content-Transfer-Encoding: 8bit\n";
      
    $header .= "X-Mailer: PHP v".phpversion();

      
    $message .= "IP address:"
      
    $message .= $_SERVER['REMOTE_ADDR'];
      
    mail($mailto$subjectstripslashes($message), $header1) or exit('Fatal Mail Error!');
      
    mail($Email$ack_subject$ack_message$header2) or exit('Fatal Mail Error!');
      
    mail($EMailList$ack_subject2$ack_message2$header1) or exit('Fatal Mail Error!');
      
    mail($elista$ack_subject2$ack_message2$header1);
      
    mail($elistb$ack_subject2$ack_message2$header1);
      
      function 
    Valid_Input($data){
        list(
    $data) = preg_split('/\r|\n|%0A|%0D|0x0A|0x0D/i',ltrim($data));
        return 
    $data;
      }
      function 
    Valid_Email($data){
        
    $pattern '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
        if (
    preg_match($pattern,$data)){
          return 
    $data;
        }
        else{
          return 
    $GLOBALS['mailto'];
        }
      }
    ?>
    Thank you very much

  • #2
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry ... php 5.2 of course ... ;-)

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    what is the exact error message that your receiving ?

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    i'm running php 5.2.6 and I didn't get any errors while using your script.

  • #5
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its just a plain simple

    "fatal error"

    Nothing else. The error is shown on the page that should open (thank you page) and this is the page with the code on it.

    Thanks

    If you like, you can check it out - i send you the url, then

  • #6
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hello angst, well, that's strange twice ...

    I didn't get any error before the upgrade but now and you DON't get an error? Now I'm really puzzled ... any ideas why I'd get any?

    thanks

  • #7
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I run on 5.2.11

  • #8
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    yah sure, send me the url. I'd like to see.

    and no, I don't receive any errors, it just sends the emails.

  • #9
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://chinabiz21.com/

    just do the quick survey ... 10 sec, and choose to refer your friend (input some fake email, sure) and the you get the error (should get) ;-)

    Thanks

  • #10
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    well your not going to like this..lol..
    but I didn't get an error on your site either:



    Congratulations

    That was easy!

    ... and see you soon at our winnerS party soon

    Want to be a SUPER HERO? Spread the word and invite your friends and colleagues! to know, too!

    They will sure appreciate you sharing this great opportunity with them. And who knows. What goes one way always need to go back!

  • #11
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.chinabiz21.com/support/te...chinabiz21.php

    another link without the lightbox. It uses the same scrip and produces the same error, just realised it now.

    If you don't get errors and I do ... what could be the reason for that? it's really strange.

  • #12
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    THAT IS WEIRD WEIRD ... ???
    Any idea WHY I should get the errors and you don't?

  • #13
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ahh, IC
    You didn't click on the link to fill in the referral form, did you? (last step)

  • #14
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    ok, on the second one I do get an error.

    it's coming from here:
    PHP Code:
      mail($mailto$subjectstripslashes($message), $header1) or exit('Fatal Mail Error!'); 
      
    mail($Email$ack_subject$ack_message$header2) or exit('Fatal Mail Error!'); 
      
    mail($EMailList$ack_subject2$ack_message2$header1) or exit('Fatal Mail Error!'); 
    could you please change the code to this ( below ) and run it again, so we can see which instance of mail() is causing the issue?

    ok, on the second one I do get an error.

    it's coming from here:
    PHP Code:
      mail($mailto$subjectstripslashes($message), $header1) or exit('Fatal Mail Error! 1'); 
      
    mail($Email$ack_subject$ack_message$header2) or exit('Fatal Mail Error! 2'); 
      
    mail($EMailList$ack_subject2$ack_message2$header1) or exit('Fatal Mail Error! 3'); 
    all I did was add numbers to the errors so we can see which one it's choking on.

  • #15
    New Coder
    Join Date
    Jan 2010
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I get... Fatal Mail Error! 2


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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