I need to send email from my website in PHP. By requirement, I can not use the built in mail() PHP function (so no sendmail). I downloaded 'mail' on my unix server and through a function in PHP should be able to connect in order to send emails. The PHP code is as follows:
<?php
function sendMail() {
shell_exec("echo mymessage | mail -s mysubject myreal@email.com");
}
?>
Unfortunately it doesn't work, but if I run that command in the unix terminal (the machine is a Centos 7) it works. I also tried the system() and exec() PHP function, but without success. How can I do this work? Thanks
EDIT: This question is not the same. I must not use the mail() PHP function but an alternative