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??
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!
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: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-14-04
Please let us know if you get things sorted!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.