Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Enabling PHP to use sendmail UNIX
Having trouble with PHP and sendmail on your OSX install? Here's a little help from macos-x-server list:

In the /etc/mail/ file, add the line
 O DontBlameSendmail=GroupWritableDirPathSafe
right after the line
 #O DontBlameSendmail=safe
and this should allow PHP to send mail out through sendmail.

[Editor's note: I have not tried this myself...]
  • Currently 2.00 / 5
  You rated: 2 / 5 (4 votes cast)

Enabling PHP to use sendmail | 9 comments | Create New Account
Click here to return to the 'Enabling PHP to use sendmail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: xchanyazy on Apr 22, '02 11:20:21AM

Instead of doing this, you could just chmod g-w /, /etc, /etc/mail. The only problem is that apple seems to reset the permissions on / at every update. Still, as I understand it, it's better to change the directories to group non-writable than it is to add in the DontBlameSendmail stuff.

[ Reply to This | # ]
chmod (aka fix sendmail permission permanently)
Authored by: bluehz on Apr 22, '02 03:32:35PM

I was having lots of problems with the permissions on / being reset on a regular basis and I belive I finally discovered and fixed the culprit. Seems the cron daily task has a line in it that resets the permissions each time back to non-group writable.

I fixed it by opening /private/etc/daily and modifying the line that reads:

touch "${i}" && chmod 600 "${i}"

changed it to:

touch "${i}" && chmod 640 "${i}"

and I have not had any problems since.

Also - you don't necessarily have to "activate" sendmail to get it to work on an "as needed" basis - you just have to fix the permissions as above. A good example if this is the fact that I do not keep sendmail process running all the time - yet the crontab status reports are mailed out as needed by calling sendmail - so it is activated on an "as needed" basis and then retired again.

If you want to delve into the mail server realm I would recommend Postfix and Qpopper instead - supposedly much more secure.

[ Reply to This | # ]
Authored by: vonleigh on Apr 23, '02 05:50:24AM

Another idea is to modify /System/Library/StartupItems/Sendmail/Sendmail and add the following lines:

chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue
chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue

Now the permissions get right every time sendmail starts up (actually, put it before the command that starts up sendmail).


[ Reply to This | # ]
Authored by: deleted_user18 on Apr 22, '02 03:09:45PM

DO NOT ACTIVATE SENDMAIL unless you know what you do!

Otherwise you will become a relay for SPAM mails very soon!

[ Reply to This | # ]
Authored by: adriaant on Apr 22, '02 05:40:41PM

Relax! By default sendmail doesn't allow relaying.

[ Reply to This | # ]
potential for abuse
Authored by: mlibbey on Apr 23, '02 11:08:14AM

Even if sendmail is configured to prevent relaying, how can one prevent users from writing scripts to use your website to spam?

[ Reply to This | # ]
Better yet...
Authored by: zellpharm on Apr 24, '02 12:21:51PM

Better yet, install Communigate Pro from and forget Sendmail. Sendmail maybe free but its a real pain to configure. I don't even bother anymore.

I have PHP running just fine with Communigate Pro.

[ Reply to This | # ]
Better yet...
Authored by: MartinFritze on Sep 23, '02 11:34:40AM

Can i use CommuniGate Pro on one machine and use it as SMTP in PHP. What should a PHP send script contain to use it like that? Do i have to configure PHP in any way?

[ Reply to This | # ]
This doesn't work.
Authored by: fnord on Nov 11, '02 02:25:36PM

I've got this setting in

Permissions on sendmail are:

-r-sr-xr-x 1 smmsp smmsp 581448 Sep 21 00:35 /usr/sbin/sendmail

Sendmail itself has been working for several months.

/usr/lib/php.ini (which is definitely getting loaded by php, confirmed with phpinfo();) has the correct path to sendmail.

I still cannot get mail() working from php.

[ Reply to This | # ]