Its because your mail config not set correctly.
Check
- Environment(if local check this / if live-host most of time it will config automaticaly)
- User Authentication(Username / password)
Sample code
$to = "abdulla@stackoverflow.com";
$subject = 'Place Order From ';
$message = 'My message goes here';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "From: ibjmpncr@thefourpobu.com";
mail($to, $subject, $message, $headers);
Requirements for php mail()
function
php.net
For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time. If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them. PHP will first look for sendmail in your PATH, and then in the following: /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It's highly recommended to have sendmail available from your PATH. Also, the user that compiled PHP must have permission to access the sendmail binary.
w3Schools
For the mail functions to be available, PHP requires an installed and working email system. The program to be used is defined by the configuration settings in the php.ini file.