I have a problem sending mail with PHP on a LAMP (redhat 7 server). I have configured sendmail
, with which I am able to send email using the following:
$ sendmail toemail@something.com <press enter>
message body <press enter>
ctrl+d (sends message)
and the message is received by any mentioned email address, successfully.
But when I use the PHP scripts (working fine on other servers), PHP scripts are unable to send any email.
No error is there in /etc/mail/maillog/
and I have tried with different paths in php.ini
in sendmail_path
e.g:
/usr/sbin/sendmail -t -i
/usr/sbin/sendmail -t
/usr/sbin/sendmail
None of the three does anything.
permission for /usr/sbin/sendmail
is 666
.
Any of the possible PHP scripts that works everywhere, does not work in this new environment. One of the scripts which I tried is as below:
<?php if(mail("receipient@domain.com","A Subject Here","Hi there,\nThis email was sent using PHP's mail function.")) print "Email successfully sent"; else print "An error occured"; ?>
Please suggest.