Closed Thread
Results 1 to 4 of 4

Thread: mail() function in php stopped working

  1. #1
    damirzay76 is offline x10Hosting Member damirzay76 is an unknown quantity at this point
    Join Date
    Jul 2011
    Posts
    2

    mail() function in php stopped working

    Hi,
    I have got php file in my site that takes data entered by user and sends it using mail() function. It has been tested and was working for more than 10 days and one or two days ago I have noticed that is not working anymore.
    It is not sending emails and it returns "false" value as a bool in php

    I didn't do any changes in the code.
    Could you please confirm that your smtp server is configured correctly and that your version of php supports mail() php function.
    If everything is configured correctly tell me what might be the reasons why mail() function stopped working on my page.
    Thank you,
    Damir

  2. #2
    Corey's Avatar
    Corey is offline VPS Migration Professional Corey is a glorious beacon of lightCorey is a glorious beacon of light
    Join Date
    Dec 2004
    Location
    Northfield, NH
    Posts
    17,151

    Re: mail() function in php stopped working

    Do you have a link to the script\page?
    Corey Arbogast | CEO
    █ 888-X10-9668 - corey[@]x10hosting.com
    x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

  3. #3
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: mail() function in php stopped working

    The following script runs fine on Chopin.
    Gmail accepts it.
    Hotmail does not bounce it, but does put it in the Spam folder.

    PHP Code:
    <?php

    date_default_timezone_set
    ('America/Los_Angeles');
    echo 
    date('l jS \of F Y h:i:s A'); 
    echo 
    "\n";

    $from "myName@myDomain.x10.bz";
    $to="myGmailAccount@gmail.com";

    $mailbody="Test message sent (PST): \n" date('l jS \of F Y h:i:s A');
    $subject="Test of PHP mail()" ;

    $headers "Content-type: text/plain; charset=windows-1251 \r\n";
    $headers .= "From: $from\r\n";
    $headers .= "Reply-To: $from\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "X-Mailer: PHP/" phpversion();

    $resp mail($to$subject$mailbody$headers);

    if( 
    $resp ){
        
    $outcome "Mail sent" ;
    } else {
        
    $outcome "Mail not sent";
    }

    print 
    "\nThe mail system said: $outcome\n\n" ;
    exit();

    ?>
    You can see if it runs on your server.
    Please note that the "From" is a real email account on your hosting account.
    Last edited by descalzo; 08-02-2011 at 06:53 PM.
    Nothing is always absolutely so.

  4. #4
    damirzay76 is offline x10Hosting Member damirzay76 is an unknown quantity at this point
    Join Date
    Jul 2011
    Posts
    2

    Re: mail() function in php stopped working

    Thank you for your replies:
    Here is the code that was working ( and stopped working now) on Hosting Server: boru

    It was working with googlemail and yahoo and now I am getting part of code executed that loads contact.php?status=failure, i.e. $sent = false and ,of course, the mail is not being sent. Anyway I was planning to move to paid hosting, so will try maybe this will solve the problem

    PHP Code:
    <?php

    $to 
    "MYTESTEMAIL@googlemail.com" 
    $name $_REQUEST['name'] ;
    $subject $_REQUEST['subject'] ;
    $email $_REQUEST['email'] ; 
    $message $_REQUEST['message'] ; 
    $intro "We have received the following information:\n\n";
    $txt sprintf("%s The message from: %s \n Email: %s \n Message: \n\n %s",$intro,$name,$email,$message);
    $headers "Email from : "$name
    $sent mail($to$subject$txt$headers) ; 
    if(
    $sent
        {
        echo 
    "<script type=\"text/javascript\"> location.replace(\"contact.php?status=success\"); //</script>";
        }
    else 
        {
        echo 
        
    "<script type=\"text/javascript\"> location.replace(\"contact.php?status=failure\"); </script>";
        }  

    ?>
    Last edited by damirzay76; 08-03-2011 at 01:29 PM.

Closed Thread

Similar Threads

  1. php mail function has stopped working?
    By g.c.simons36 in forum Free Hosting
    Replies: 0
    Last Post: 02-13-2011, 10:41 AM
  2. PHP mail() stopped working
    By wbaptist in forum Free Hosting
    Replies: 7
    Last Post: 02-25-2010, 03:23 PM
  3. PHP mail() stopped working
    By wbaptist in forum Free Hosting
    Replies: 1
    Last Post: 02-05-2010, 11:57 AM
  4. Mail server has stopped working :S
    By jamesod in forum Free Hosting
    Replies: 5
    Last Post: 08-13-2009, 06:11 PM
  5. mail() stopped working...
    By altruistic89 in forum Free Hosting
    Replies: 1
    Last Post: 10-15-2007, 01:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers