The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mail function not working

Discussion in 'E-mail Discussions' 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:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    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.
     
  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:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Glad you got that worked out and thank you for updating this thread with your solution.
     
Loading...

Share This Page