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.

2 Answers 2

  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.
  • I really doubt that this will work in practice. Sendmail as pre-installed isn't going to function as a full blown mailer reliably on the Internet. It will not announce itself properly and most likely be considered a source of spam. Setting up a smarthost should be included in these instructions and is non-trivial depending on the ISP involved. Commented Jul 8, 2009 at 18:03
  • 1
    You are right that this wouldn't be terribly reliable if you are using it to mail users/newsletters/etc but for the stated purpose it should work just fine.
    – moshen
    Commented Jul 8, 2009 at 19:10
  • I will only use it for mails to admin, where I have control of the spam filter and can avoid the false positives. For user mails I use smtp. In fact I want this as a fallback to inform me when there is a problem with smtp.
    – user12096
    Commented Jul 9, 2009 at 19:28
  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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .