0

I'm almost loosing my mind here with a problem that I have, so I will appreciate any help you guys can provide me. I deployed a Bitnami LAMP instance from the Amazon templates that they provide and I'm using it to run my web site (PHP based), now as part of the web site there is a contact us page that is using the PHP function mail().

My problem is that when I try to use that from the web (from my web server) it doesn't work but when I run the exact same code from the local host - just by SSHing to the machine and running the code it does work.

I saw plenty of articles about it and it seems like it is something to do with the configurations on the server itself but I'm not sure what, the most interesting and I think the one that makes sense is one that tells me to enable the httpd_sendmail in the SELinux configuration, but then the problem is that when I try that I'm getting an error saying that SELinux is disabled and I don't know how to enable it.

The code that I'm using is the following:

if(mail("MYMAIL@gmail.com", "TEST", "TESTING FROM SERVER", "From:MYMAIL@gmail.com"))
{
     $report='Email Successfully Sent';
       } 
       else
       {
         $report='Email Sent Failed!! Try Again';
       } 
   if(isset($report))
   {
      echo'<script>alert("'.$report.'");</script>';
   }

Please please help ! :)

Thanks in advance to everyone !

1 Answers1

0

Once I have a problem sending email to Gmail like "name@serverdomain.com" from server. I've changed configuration of email domain on server to some random string, it was as like "serverdomain". And then emails start to send. You may try it.

Another way to use PHPMailer link on github and email server.