I'm trying to get the PHP mail() function to work. But it fails to send emails. I run Ubuntu 11.04. I installed sendmail.
I opened the php.ini and set
; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = /usr/sbin/sendmail -t sendmail_from = email@example.com
Then I restarted apache.
Then created a simple PHP script to test it but no luck.
When I try to run sendmail it gives me a permissions error, so I have to run 'sudo sendmail'. Does my mail system failure have anything to do with permissions? Is there further configuration I need to do with sendmail?
EDIT: The error is this:
user@server:~$ sendmail Command 'sendmail' is available in '/usr/sbin/sendmail' The command could not be located because '/usr/sbin/' is not included in the PATH environment variable. This is most likely caused by the lack of administrative privileges associated with your user account. sendmail: command not found user@server:~$ sudo sendmail sendmail: No recipients supplied - mail will not be sent