What are the steps to make the php mail() function work on ubuntu-server?

Solution 1:

  1. The sendmail package. No problems with it really, might even be installed by default.
  2. # echo "test" | mail -s "test" [email protected]
  3. None other then that. Check out the reference page.

Solution 2:

  1. If you want to just send mail (without full blown MTA), you can install nullmailer packages.
  2. Yes, you have to allow outgoing connections to TCP port 25. To be more restrictive, open only to your SMTP server address.