Linux – Trouble getting Postfix working on Centos

centoslinuxPHPpostfixsendmail

I'm having problems getting PHP to send mail via Postfix on CentOS Linux 5.6.

I've got Postfix version 2.3.3, which was installed with Yum. I also installed Dovecot as per a tutorial, though I'm not sure whether I need this just to send via SMTP.

When the PHP mail() command runs I get this in /var/log/maillog:

Aug 22 10:30:57 ade1 postfix[5798]: error: to submit mail, use the Postfix sendmail command
Aug 22 10:30:57 ade1 postfix[5798]: fatal: the postfix command is reserved for the superuser

I have Webmin installed, and here's the SMTP settings page: http://dl.dropbox.com/u/618674/_perma/2011-08/webmin-postfix-smtp.png

I entered some config settings changes in /etc/postfix/main.cf as per this tutorial:
http://wiki.centos.org/HowTos/postfix

In /etc/php.ini I have this:

sendmail_path = /usr/sbin/postfix -t -i

Anyone got any ideas about this "to submit mail, use the Postfix sendmail command" error?

Would I be better using Sendmail? I was advised that Postfix was simpler!

Cheers 🙂

Also… (may be related),

chkconfig –level 345 dovecot on

returns this:

failed to make symlink /etc/rc0.d/K74lvm2-monitor: File exists
failed to make symlink /etc/rc1.d/S26lvm2-monitor: File exists
failed to make symlink /etc/rc2.d/S26lvm2-monitor: File exists
failed to make symlink /etc/rc3.d/S26lvm2-monitor: File exists
failed to make symlink /etc/rc4.d/S26lvm2-monitor: File exists
failed to make symlink /etc/rc5.d/S26lvm2-monitor: File exists
failed to make symlink /etc/rc6.d/K74lvm2-monitor: File exists
failed to make symlink /etc/rc0.d/K35dovecot: File exists
failed to make symlink /etc/rc1.d/K35dovecot: File exists
failed to make symlink /etc/rc2.d/K35dovecot: File exists
failed to make symlink /etc/rc3.d/S65dovecot: File exists
failed to make symlink /etc/rc4.d/S65dovecot: File exists
failed to make symlink /etc/rc5.d/S65dovecot: File exists
failed to make symlink /etc/rc6.d/K35dovecot: File exists
failed to make symlink /etc/rc3.d/S65dovecot: File exists
failed to make symlink /etc/rc4.d/S65dovecot: File exists
failed to make symlink /etc/rc5.d/S65dovecot: File exists

Best Answer

You're getting confused between Sendmail the software, and /usr/sbin/sendmail the standardised interface for sending mail. Revert your sendmail_path back to it's default value and everything will be fine. Postfix provides a sendmail-compatible wrapper that does the right thing about getting mail into the Postfix system.

And, by the way, no, you don't need Dovecot to send mail via SMTP.