I have setup a server with the following settings:
CentOS release 6.3 (Final)
Kernel \r on an \m
Linux version 2.6.32-279.14.1.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Tue Nov 6 23:43:09 UTC 2012
I have installed Qmail and Cron.
When I send an e-mail through a Webmin interface (using Qmail), the mail arrives. However, when I try to send an email through a php script, I get the following error message in /var/log/maillog
:
Failed to create spool file /var/spool/exim/input//1V8rf1-0005w0-Jx-D: Permission denied
Cannot open main log file "/var/log/exim/main.log": Permission denied: euid=93 egid=93
exim: could not open panic log - aborting: see message(s) above
And in /var/log/virtualmin/[host]_error_log
:
PHP Fatal error: <br /><strong>Uncaught Error</strong> of type [Swift_ConnectionException] with message [Sending failed using mail() as PHP's default mail() function returned boolean FALSE
I seems like it is some kind of permission issue (or an issue with qmail and exim), however I am not able to solve it after researching for a few days now. I have Webmin and Virtualmin installed.
Some extra information on permissions:
$ ls -l /var/spool/exim/
total 32
drwxrwxrwx. 2 exim exim 4096 Oct 28 2012 db
drwxrwxrwx. 2 exim exim 24576 Aug 9 16:52 input
drwxrwxrwx. 2 exim exim 4096 Aug 9 16:52 msglog
$ ls -l /usr/sbin/exim
-rwsr-xr-x. 1 root root 1118184 Oct 28 2012 /usr/sbin/exim
Anybody suggestions? Help would be very much appreciated.
Best Answer
First Part The exim system requires that the spool directories and the log directories be writable by the exim user (the user the process runs as). The simple fix for exim would have been:
Second Part Typically there is a /usr/sbin/sendmail wrapper which is really just a symlink to whatever provides "sendmail compatibility" on your system. When you installed exim, it created a symlink /usr/sbin/sendmail which ended up pointing to /usr/sbin/exim. [1] When you deleted the exim package, it removed the /usr/sbin/sendmail link. When cron starts up a job, it starts it and pipes it to /usr/sbin/sendmail. Since it no longer exists, the job fails to start completely.
The preferred fix is to use the "alternatives" system to update each of the mta components that the "alternatives" system manages:
If that doesn't work for you (because qmail didn't configure itself as part of the "alternatives" system, then the simplest fix is to manually create that symlink:
[1] Technically, the "alternatives" system manages and created a symlink /usr/sbin/sendmail which pointed to /etc/alternatives/mta, which is a symlink to /usr/sbin/sendmail.exim. That /usr/sbin/sendmail.exim is also just a symlink to /usr/sbin/exim.