Question
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: ”. “help@mysite.com”. “\r\n”;
$headers .= “X-Mailer: PHP/” . phpversion();
$headers .= “X-Priority: 1” . “\r\n”;
if(mail(’mymail@hotmail.com’, ‘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 “mymail.mysite.com”
2°: Check if the linux command “hostname” return “mymail.mysite.com” (Yes it returns)
3°: Install postfix “sudo apt-get install postfix”, select internet, and insert “mymail.mysite.com” 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??
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.
×