Email from php scrip not working anymore

arcticbit

Member
May 20, 2009
13
0
51
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?
 

arcticbit

Member
May 20, 2009
13
0
51
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
 

Infopro

Well-Known Member
May 20, 2003
17,090
516
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
Do the cpanel developers read this forum?
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.
 

arcticbit

Member
May 20, 2009
13
0
51
You might look into making sure your script is authenticating properly by using an actual email account to see if that helps.
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
 

arcticbit

Member
May 20, 2009
13
0
51
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
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,
 

ocbox

Member
Dec 6, 2005
11
1
153
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
 

Infopro

Well-Known Member
May 20, 2003
17,090
516
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
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

I would. From your error message:
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
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 ([email protected]) 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.
 

arcticbit

Member
May 20, 2009
13
0
51
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 ([email protected]) 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.
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,