Hi, I know how to use the mail() function and all but for some reason, I'm getting errors ONLY SOMETIMES from this new host I have. i created a test mail() just to test it. The error only happens about 1 out of 10 times. I don't know why, could somebody help? Any help would be greatly appreciated. Thanks.

Sample Code test

<?php
ini_set('sendmail_path', '/usr/sbin/sendmail -t -i');
mail('thewird@yahoo.com', 'Test', 'Is this working?', "From: [email]you@yourdomain.com[/email]\nMIME-Version: 1.0");
?>

Error that occurs about 1 out of 10 times

Warning: mail(): Could not execute mail delivery program '/usr/sbin/sendmail -t -i' in /home/thewird/public_html/oilfight/test.php on line 3

thewird

    Is there some PHP code I could add so that if the error happens, it will try resending it until there is no error? Thanks in advance.

    thewird

      the function will return false when this happens...so something like

      while( ($ret = @mail(...)) == FALSE) {}
      

      its a strange error they must have a busy mailserver and sometimes sendmail hangs up for some reason.

        HELP!!!

        That code sent the server into a loop and now its sending me a ton of e-mails non-stop. The code is...

        <?php
        ini_set('sendmail_path', '/usr/sbin/sendmail -t -i');
        while($ret = @mail(mail('thewird@yahoo.com', 'Test', 'Is this working?', "From: [email]test@yourdomain.com[/email]\nMIME-Version: 1.0")) == FALSE) {};
        ?>

        How do I stop it? What did I do wrong?

        thewird

          Write a Reply...