I have a php script to send a mail which isn't working on ubuntu server. But after logging in from server if i fire this command
echo "body" | mail -s "subject" root
then it works properly..im also able to receive email from this command but not using the script from the code
Can anyone tell me what wrong am i doing?
This is my PHP Script to send email :
<html>
<head>
<title>Sending HTML email using PHP</title>
</head>
<body>
<?php
$to = "test@gmail.com";
$subject = "This is subject";
$message = " Testing email service from my website. ";
$header = "From: someone@gmail.com \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true ) {
echo "Message sent successfully ...";
}else {
echo "Message could not be sent...";
}
?>
</body>
</html>