Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 10955  / 2 Years ago, mon, february 14, 2022, 1:59:48

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 protected]


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?



Thanks.



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

More From » 11.04

 Answers
5

I did this



sudo apt-get install postfix



And now everything is running perfectly. Sendmail apparently isn't the answer. Postfix is.


[#44183] Wednesday, February 16, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tubequ

Total Points: 11
Total Questions: 113
Total Answers: 115

Location: Equatorial Guinea
Member since Thu, Oct 7, 2021
3 Years ago
;