Ubuntu 14.04 mail() dont send email

Let´s go, I have PHP5 with apache2 installed in my Ubuntu 14.04 x64 with 512MB.

Great, I have a php file inside my server that execute this code below:

$headers = “MIME-Version: 1.0” . “\r\n”; $headers .= “Content-type: text/html; charset=iso-8859-1” . “\r\n”; $headers .= "From: ". “help@mysitecom”. “\r\n”; $headers .= "Reply-To: ". “”. “\r\n”; $headers .= “X-Mailer: PHP/” . phpversion(); $headers .= “X-Priority: 1” . “\r\n”;

if(mail(‘’, ‘hello’, ‘world’, $headers)){ echo “Status: OK”; }else{ echo “Status: False”; }

When I run I receive the following message: “Status: False”, Of course I don´t configure the mail server.

For this I use this steps:

1°: Change my hostname to “” 2°: Check if the linux command “hostname” return “” (Yes it returns) 3°: Install postfix “sudo apt-get install postfix”, select internet, and insert “” inside system mail.

Great! Let´s test my php file and now I receive the message: “Status: OK”, Great! Now lets wait for my email…(5 minutes)…(1 hour)…(1 day)… NOTHING COMES TO MY HOTMAIL.

What I´m doing wrong??

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @sdanz,

It seems like there could be a configuration problem with your linux server’s mail system. Have you looked in the logs (/var/log), specifically the mail log, to see if there are any error messages there? Which mail transfer system have you been using?

If you haven’t setup a mail system yet, have a look through this tutorial:

Please let us know if you get things sorted!