4

I have a PHP program using the mail() function. I have this running on a Linux server. Normally it is setup to run over the Linux sendmail function but my machine is setup to use Postfix.

Can I use the PHP mail function over postfix and if so does anyone know how to make that work?

Brad
  • 159,648
  • 54
  • 349
  • 530
jcmitch
  • 2,088
  • 9
  • 27
  • 33
  • 5
    PHP's mail will use whatever mailer is installed. Postfix provides a 'sendmail' compatibility executable (basically 'sendmail' is hardlined to 'postfix') so any app which is sendmail-aware will work without modification with postfix. – Marc B Nov 07 '11 at 17:44
  • @MarcB okay so to get sendmail setup I had to edit the php.ini file to un-comment the line giving the path showing where to find sendmail. Would it be the same path to use postfix? – jcmitch Nov 07 '11 at 17:47
  • 1
    `whereis sendmail` should tell you which path to use. And if you look at the sendmail that command returns, you'll find it's a symlink (or maybe a hardlink) pointing at `postfix`. – Marc B Nov 07 '11 at 17:49
  • It might be a symlink pointing to something like /etc/alternatives/mta (IE on RHEL 6 and probably Fedora) – Alice Wonder Nov 07 '11 at 20:10

2 Answers2

0

mail() uses script given in php.ini file - "sendmail_path".

If You want to change it, you need to change "sendmail_path" in php.ini or script itself.

0

try to revise this in php.ini:

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = /etc/postfix
beasone
  • 1,073
  • 1
  • 14
  • 32