0

I can send emails from the command line using sendmail,

I can call a php script ( php -f sendmail.php ) from the command line and the mail sends successfully,

but if I call the exact same script from the website ( https://www.bradfordjam.org.uk/sendmail.php ) I get a bool false and no email.

searching phpinfo() at https://www.bradfordjam.org.uk/test.php gives me:

sendmail_path   /usr/sbin/sendmail -t -i    /usr/sbin/sendmail -t -i

which doesn't work. Calling

php -i | grep sendmail

from the command line php gives me

sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i

which does.

Genuinely stumped. Any idea? Thanks.

2 Answers2

1

drookie set me on the right path. All it took was

setsebool -P httpd_can_sendmail=on

so thank you drookie. have a much deserved upvote.

0

Looks like selinux issue. Try setenforce 0 from cli, then send mail using web.

drookie
  • 8,625
  • 1
  • 19
  • 29