php mail() error: Undefined subroutine &main::maskdir

Jim Huang

Registered
May 29, 2016
2
0
1
Netherlands
cPanel Access Level
Website Owner
php mail() function suddently give this error last few days.
I have tried these:
cp /etc/exim.pl /etc/exim.pl.bak
cp -rpf /etc/exim.pl.local /etc/exim.pl
/scripts/buildeximconf
service exim restart

exim -bt -d-resolver *****@gmail.com

tail -f /var/log/exim_mainlog

2016-05-30 03:05:33 cwd=/home/*****/public_html/m3 3 args: /usr/sbin/sendmail -t -i
2016-05-30 03:05:34 1b7Be9-0004bF-TY <= *****@*****.com U=***** P=local S=939 T="***** new password" for ******@hotmail.com
2016-05-30 03:05:34 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1b7Be9-0004bF-TY
2016-05-30 03:05:34 1b7Be9-0004bF-TY SMTP connection outbound 1464570334 1b7Be9-0004bF-TY *****.com *****@*****.com
2016-05-30 03:05:34 1b7Be9-0004bF-TY == *****@*****.com R=lookuphost defer (-1): lookuphost router failed to expand add_headers item "NULL": Undefined subroutine &main::maskdir called at /etc/exim.pl line 1132.\n
 

g-force

Member
Jun 24, 2006
6
0
151
A client of mine notified me that all emails sent from PHP were failing. After investigation, I found I had the same error as above. I tried the following :

/scripts/upcp --force
/scripts/buildeximconf
service exim restart

It didn't work, so I changed the line 1132 in the file /etc/exim.pl from :
my $xsourcedir = maskdir($ENV{'X-SOURCE-DIR'});
To :
my $xsourcedir = $ENV{'X-SOURCE-DIR'};

After restarting exim, PHP was able to start sending emails again.

Can someone from cPanele explain what caused this problem and how to prevent it in the future?
 

hamadino

Registered
PartnerNOC
May 21, 2006
2
0
151
I got the same problem.

I changed the line 1132 in the file /etc/exim.pl from :
my $xsourcedir = maskdir($ENV{'X-SOURCE-DIR'});
To :
my $xsourcedir = $ENV{'X-SOURCE-DIR'};


Thank you g-force

Waiting for cPanel explanation or work around
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
Hello,

It's possible this is related to the issue reported on the following thread:

Email stopped working after update

Could anyone experiencing this issue review that thread and let us know if the solution addresses the issue with sending out emails via PHP?

Thank you.
 

santrix

Well-Known Member
Nov 30, 2008
225
2
68
This doesn't appear to relate to the exim.pl permissions bug to which cPanelMichael refers.

We have now found that the Tweak Settings > Mail > "Track email origin via X-Source email headers", when enabled, immediately causes messages like this in exim_mainlog:

Code:
2016-06-09 09:15:39 1bAv7q-000bDV-CM == [email protected] R=dkim_lookuphost defer (-1): dkim_lookuphost router failed to expand add_headers item "NULL": Undefined subroutine &main::maskdir called at /etc/exim.pl line 1132.\n

2016-06-09 09:15:44 H=([x.x.x.x]) [x.x.x.x]:24865 I=[x.x.x.x]:25 sender verify defer for <[email protected]>: dkim_lookuphost router failed to expand add_headers item "NULL": Undefined subroutine &main::maskdir called at /etc/exim.pl line 1132.
Disabling this option makes the problem go away. We are seeing this beahaviour on dozens of servers, running CloudLinux 6 and 7 and cPanel v56.22. We have not yet opened a support request with cPanel.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
New This doesn't appear to relate to the exim.pl permissions bug to which cPanelMichael refers.
Were you able to verify the permissions for the /etc/exim.pl file on the affected systems? You can do so with a command such as:

Code:
stat  /etc/exim.pl
Thank you.