Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 7 down vote accepted
  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.
share|improve this answer
    
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. –  Kevin Kuphal Jul 8 '09 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 Jul 8 '09 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 Jul 9 '09 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.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.