How to set up server to send emails using mail() - a php function?

Posted March 23, 2015 32.2k views

Hi, we’ve installed all programs we need in our droplet and we are using it to develop a project.
So far we’ve set up in our ubuntu droplet: nginx, php 5 and ruby.
We’ve installed php 5, we followed some tutorials here…it seems everything is set up, but when we use the command mail() in a php program inside our server, it seems to work, but the email is never received.
Something is wrong....we think there may be something we forgot to set up, since we are used to use hosting services from companies that offer everything already set up within the infrastructure. could you please help us?
Thank you!

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.

Submit an Answer
2 answers

You will need an MTA to process outgoing mail on your server. You can use sendmail or postfix (I recommend postfix). To install postfix:

apt-get update;
apt-get install postfix;

Thanks for your help! great! All we’ve gotta do is run those commands? or there’s some extra configuration we’ll need to do?