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

emailPHPsendmailUbuntu

I want to enable the simple php mail() function on an Ubuntu server. This will only be used for sending administration stuff and logs. This is all the mail functionality that I want on this machine.

1) Can you name 1 or 2 simple to setup standard ubuntu packages that I can use for this? Should take few resources and few dependencies. Which are the most common packages for this purpose and what are the pros and cons for what I want to do with it? (This machine wll never receive mail.)

2) After I have chosen a mailer package, how will I test it from the command line? Is it correct I will have to allow outgoing connections to remote port 25?

3) Are there any steps to make sure php can use it now for the mail() function?

I want this as a recipe for future server installations I can follow, so it would be interesting to know what can go wrong and how to deal with it.

Edit: I installed sendmail in the end, and this removed exim4. Php mail() worked after that. So for me sendmail seems easier than exim4. The formerly installed php5 with exim4 did not send mails.

Best Answer

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