Question

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

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!


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.

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?

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;