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.

Email from php scrip not working anymore

Discussion in 'E-mail Discussions' started by arcticbit, May 26, 2016.

  1. arcticbit

    arcticbit Member

    Joined:
    May 20, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    After WHM ugrade to 56.0 the php mail function is not working / sending out email anymore.
    ex. mail($to, $subject, $body, $header);

    The Prevent “nobody” from sending mail is: off.

    It was working before, so this is a resulatat of automatic whm updating.

    Anyone have some idea on what could be the problem?
     
  2. g-force

    g-force Member

    Joined:
    Jun 24, 2006
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
  3. arcticbit

    arcticbit Member

    Joined:
    May 20, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hello g-force,

    thanks for the reply, unfortunately the solution don't works for me.

    This is copy of my exim log:

    2016-06-02 13:45:03 cwd=/home/****/public_html 3 args: /usr/sbin/sendmail -t -i
    2016-06-02 13:45:03 1b8f-0003T7-AT F=<****@****'.****.com> rejected by non-SMTP ACL: failed to expand ACL string "${if eq{$originator_uid}{${perl{user2uid}{nobody}}}{1}{0}}": Undefined subroutine &main::user2uid called.
    2016-06-02 13:45:03 cwd=/var/spool/exim 7 args: /usr/sbin/exim -t -oem -oi -f <> -E1b8f-0003T7-AT
    2016-06-02 13:45:03 1b8f-0003T9-Az F=<> rejected by non-SMTP ACL: failed to expand ACL string "${if eq{$originator_uid}{${perl{user2uid}{nobody}}}{1}{0}}": Undefined subroutine &main::user2uid called.
    2016-06-02 13:45:03 1b8f-0003T9-Az Error while reading message with no usable sender address (R=1b8f-0003T7-AT): rejected by non-SMTP ACL: local configuration problem
    2016-06-02 13:45:03 1b8f-0003T7-AT Child mail process returned status 1
    2016-06-02 13:45:25 SMTP connection from [127.0.0.1]:55734 (TCP/IP connection count = 1)
    2016-06-02 13:45:25 SMTP connection from (localhost) [127.0.0.1]:55734 closed by QUIT

    This is the php code i try to execute:

    $msg = "Test text";
    mail("****@****.com","Test Mail",$msg);

    Does anybody have any idea what the problem is?

    Do the cpanel developers read this forum?
    Maybe they can fix this problem in the next version of whm?, or maybe it's a configuration setting in whm?

    Regards
     
  4. g-force

    g-force Member

    Joined:
    Jun 24, 2006
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    In WHM : Home »Server Configuration »Tweak Settings
    Do you have Enable BoxTrapper spam trap at On?

    I had to enable it, then did the following :
    /scripts/upcp --force
    /scripts/buildeximconf
    service exim restart

    After that, I faced the problem on the other thread :
    php mail() error: Undefined subroutine &main::maskdir
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,447
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Yes, but this issue seems to be with the script itself. Please feel free to open a ticket to cPanel Technical Support if you wish, but they won't be able to assist you with your script.

    You might look into making sure your script is authenticating properly by using an actual email account to see if that helps.
     
  6. arcticbit

    arcticbit Member

    Joined:
    May 20, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Yes , smtp auth from other scripts to an actual email account works fine, if that's what you think I should try? (but that's not the issue om my problem)

    Regards
     
  7. arcticbit

    arcticbit Member

    Joined:
    May 20, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Yes, BoxTrapper spam trap was on. The &main::maskdir error is generated when trying to send email from ZenCart.
    The second message comes when I try to send from php script above.

    I'm not comfortable with editing configuration files (/etc/exim.pl), and running scripts from the root account as you suggest. It can quickly lead to new problems.

    regards,
     
  8. ocbox

    ocbox Member

    Joined:
    Dec 6, 2005
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Just spent hours on this, you probably have the same problem. Latest update set permissions incorrectly on /etc/exim.pl
    You will probably need to chmod 644 /etc/exim.pl then service exim restart

    I hope this helps someone else
     
  9. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,447
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:

    I would. From your error message:
    From the docs for xencart configuration, it seems you can set the script to not use sendmail:
    zen-cart.com/wiki/index.php/Admin_-_Configuration_-_E-Mail_Options

    Code:
    
    SMTP Email Account Mailbox
    (Admin - Catalog)
    
        Enter the mailbox account name (me@example.com) supplied by your host. This is the account name that your host requires for SMTP authentication. Only required if using SMTP Authentication for email.
        Default: YourEmailAccountNameHere
    
    
    SMTP Email Account Password
    (Admin - Catalog)
    
        Enter the password for your SMTP mailbox. Only required if using SMTP Authentication for email.
        Default: YourPasswordHere
    
    
    SMTP Email Mail Host
    (Admin - Catalog)
    
        Enter the DNS name of your SMTP mail server. Only required if using SMTP Authentication for email.
        Default: mail.EnterYourDomain.com
    
    
    SMTP Email Mail Server Port
    (Admin - Catalog)
    
        Enter the IP port number that your SMTP mailserver operates on. Only required if using SMTP Authentication for email. Not used in 1.3.0.2.
        Default: 25
    This should be a more acceptable way to send email from your script, I think.

    Not sure if that helps your issue specifically, but its certainly worth setting things up this way proper.
     
  10. arcticbit

    arcticbit Member

    Joined:
    May 20, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    I agree that using smtp authentication for email is a more acceptable way to send email from.

    It must have been an error with the Cpanel installation on my server.
    I performed a reinstall of CentOS and cpanel on the server, and now everything works as before.
    I can now send email from php script again (without using smtp auth).
    Remember to backup accounts on your server before reinstall.

    regards,
     
  11. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,447
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    A bit extreme I think. Remember to secure your server properly.
     
Loading...

Share This Page