Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having issues trying to get PHP's mail function to work on my Ubuntu 9.04 VPS with sendmail and Apache (and other less relevant stuff, of course).

From PHP I receive no error, save a return value of false from the mail function.

The last error in /var/log/mail.err is

sendmail[14837]: NOQUEUE: SYSERR(www-data): can not chdir(/var/spool/mqueue-client/): Permission denied

Now, I appreciate that this is saying www-data (the user Apache is running as) does not have read access on some required directory (/var/spool/mqueue-client).

So, knowing that (and for test purposes only), I ran chmod 777 /var/spool/mqueue-client and reran the script, which this time succeeded (hurray), however /var/log/mail.err now says

sendmail[14874]: dangerous permissions=42777 on queue directory /var/spool/mqueue-client/

So I'm wondering how I can configure things so my script can run using non-dangerous permissions.

share|improve this question
First advice: Switch to Postfix. Second: Who is owner:group of /var/spool/mqueue-client? What were the permissions before switching to 777? Why are you still using Ubuntu 9.04 and not 10.04 LTS? – mailq Oct 11 '11 at 22:59
I can't switch to postfix as apt no longer works on Jaunty. Owner/group of mqueue-client are both smmsp. I'm not certain what the permissions were before I switched them (rookie error), however setting 770 reverts it to the old chdir related error. Long story short on LTS is that my VPS provider does not make it easy to dist-upgrade. I will probably upgrade nearer the end of thos month by creating a new VPS and cancelling the old one. – Minty Oct 11 '11 at 23:22
Which sendmail version are you running? ls -l $(which sendmail)? groups smmsp? – quanta Oct 12 '11 at 2:03
8.14.3 / lrwxrwxrwx 1 root root 26 Oct 4 12:05 /usr/sbin/sendmail -> /etc/alternatives/sendmail / smmsp sasl – Minty Oct 12 '11 at 3:05

You could try to chmod 775 the /var/spool/mqueue-client and then add www-data to the smmsp group. I agree though if you can switch to postfix somehow, you would be much better off.

share|improve this answer
That still gives me the permissions error, and also sendmail[15164]: NOQUEUE: SYSERR(www-data): can not write to queue directory /var/spool/mqueue-client/ (RunAsGid=33, required=114): Permission denied – Minty Oct 11 '11 at 23:40
Ooh, you may need to restart apache, (not reload) – Michael Irey Oct 11 '11 at 23:42
It looks like the appropiate permissions are 770: drwxrwx--- smmsp smmsp ... /var/spool/mqueue-client And with www-data added to /etc/group it should have access to read/write, however this is work around and still may be a security issue. – Michael Irey Oct 11 '11 at 23:47
I seems that www-data did not get added to the smmsp group. Try: useradd -G smmsp www-data as root. Then be sure to restart apache. – Michael Irey Oct 12 '11 at 3:34
Sorry - should be usermod -a -G smmsp www-data – symcbean Oct 13 '11 at 10:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.