Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

mail function not working

Discussion in 'E-mail Discussion' started by sreeninair, Jan 28, 2014.

  1. sreeninair

    sreeninair Well-Known Member

    Joined:
    Dec 23, 2013
    Messages:
    100
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hello,

    I am unable to send using mail() function. Please see the details.

    ========

    Test mail php file.


    ]# cat testmail.php
    <?
    if (mail('tewstuhidw9j@gmail.com', 'PHP test', 'This is a test of mail().')) {
    echo "Mail successful";
    } else {
    echo "Mail failed.";
    };
    ?>

    Browser output :Mail failed.


    ==========

    Apache Error log:

    sh: /usr/local/bin/sendmail-logger: No such file or directory

    # ll /usr/local/bin/sendmail-logger
    -rwxr-xr-x 1 root root 169 Jun 25 2013 /usr/local/bin/sendmail-logger*

    # which sendmail
    /usr/sbin/sendmail

    #grep sendmail /usr/local/lib/php.ini
    ;sendmail_from = me@localhost.com
    ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
    ;sendmail_path = "/usr/sbin/sendmail -t -i"
    sendmail_path=/usr/sbin/sendmail -t ;
    ;sendmail_path = /usr/local/bin/sendmail-logger

    ===============


    Kindly assist.

    Thanks
    Sreeni
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,699
    Likes Received:
    1,790
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    Do you notice any error messages in the error_log within the script's directory, or in the Apache error log (/usr/local/apache/logs/error_log)? Which PHP handler are you using? Is "Prevent “nobody” from sending mail" enabled under the "Mail" tab in "Tweak Settings" within WHM?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. sreeninair

    sreeninair Well-Known Member

    Joined:
    Dec 23, 2013
    Messages:
    100
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hello Michael,

    The Prevent “nobody” from sending mail" enabled under the "Mail" was enabled. The error message in apache log was 'sh: /usr/local/bin/sendmail-logger: No such file or directory'. I have fixed it by running upcp --force after removing exim from /etc/yum.conf (exclude) . Thanks for your help.

    Thanks
    Sreeni
     
  4. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    575
    Likes Received:
    20
    Trophy Points:
    93
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Glad you got that worked out and thank you for updating this thread with your solution.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice