php and mail function

Hello,

I have a problem sendin emails from my php script, if I try to send from bash it`s working, I was wondering if you can give me an advice in solving this problem.

code:


<?php
 $to = "test@test.com"; //here goes the real email address 
 $subject = "Hi!";
 $body = "Hi,

How are you?";
 if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
 ?>

I get only “Message successfully sent!”, but no email.

Thank you.

Look in /var/log/mail to see what happened to it.

I used a class.phpmailer.php and it`s working perfectly now.