Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a desktop install of ubuntu, not server. But I am running a localhost LAMP stack for development. Is there a simple mail server I can install so that PHP's sendmail works?

Ideally it will have few options and minimal configuration, and preferably a GUI rather than CL interface.

EDIT to add - do I use the Local Only configuration to test php mail()? enter image description here

share|improve this question
add comment

4 Answers 4

up vote 4 down vote accepted

The easiest one I've ever installed is postfix with dovecot. There is a dovecot-postfix package, but it also looks like the Ubuntu server team has packaged this as mail-stack-delivery :

Description: mail server delivery agent stack provided by Ubuntu server team
 Ubuntu's mail stack provides fully operational delivery with
 safe defaults and additional options. Out of the box it supports IMAP,
 POP3 and SMTP services with SASL authentication and Maildir as default
 storage engine.

Looking in the Software Center, I see that dovecot-postfix is present as a meta-pacakge (but I don't know if it will be called that a release or two from now). But that is what I'd recommend -- it's straightforward and secure.

From the command line on my 10.10 desktop, I installed this via apt-get :

sudo apt-get install dovecot-postfix

Give it a shot if you like, and if you have questions, just start a new post.


Here's a oldish (2009) Ubuntu Server Blog post that gives some of the details on the dovecot-postfix configuration.

I'm trying to find out more information on the current status of Ubuntu-centric mailserver projects. Right now I'm not finding much more than a May 2010 wiki post about making anti-spam/virus integration easier.

share|improve this answer
1  
Why do you want to use Dovecot as well? It's a POP3/IMAP server. Unless someone wants to receive mails too and give the ability to the user to access them via POP3/IMAP, it's not needed. Only one thing when it can be useful: postfix can use dovecot's auth daemon to use as authentication backend for SMTP authentication. However I think it's not needed for PHP's mail(), unless someone has its own "manually written" mailing solution for PHP which involves even SMTP authentication in case of mail submission. In other cases, simply "postfix" package should be enough. –  LGB Feb 11 '11 at 17:07
    
I know it was easily configured, and I installed it for the auth and security features, as you mentioned. I've installed it and it works, whereas I have not installed just postfix by itself on an Ubuntu system, so I can't personally vouch for that. –  belacqua Feb 11 '11 at 17:27
    
@jgbelacqua, so I decided to give your version a shot. Since this is strictly a dev environment, and all I want to do is test php mail() functionality, would I use the Local configuration? (I've added a screenshot of the config screen to my original post.) –  EmmyS Feb 11 '11 at 18:30
    
We use postfix at our ISP where I work, but of course it's not the scale of "simple mail server for PHP mail() only" :) –  LGB Feb 11 '11 at 18:30
1  
@jgbelacqua - thanks. It worked! I had to change the protocol setting from sendmail to just plain mail (in my php code) but it did send just fine. –  EmmyS Feb 11 '11 at 22:21
show 1 more comment

You do not need a mail server to send email, only to receive email. For sending email (using sendmail) select the Internet with smarthost option.

share|improve this answer
add comment

Just postfix is needed.

For setup, just use the defaults. Internet site. When you get to it, there's a section for setting which computers are allowed to relay mail through the server. The default is 127.0.0.1 (worded slightly more verbosely) and this is good. This means even if another computer can connect to postfix, postfix wont allow it to send mail anwhere but to the destinations postfix accepts as "local" domains.

But good network security on top won't hurt. A router blocking incoming connections and/or a firewall (see ufw) will stop anybody else contacting postfix.

If you need to reconfigure, just run:

sudo dpkg-reconfigure postfix
share|improve this answer
    
For testing I would set it up to use your ISP's relay as a Smarthost. To run properly over the Internet you need a static IP address, and the right DNS entries. –  BillThor Feb 11 '11 at 22:15
    
@BillThor No. Not to send email. You only need a very simple setup with no provisions for incoming connections. –  Oli Feb 11 '11 at 22:23
    
@Oli True but without the proper DNS records many sites will steer your email into the Spam bucket. If your address is dynamic and listed in Spamhaus it will be refused entirely by many domains. –  BillThor Feb 11 '11 at 22:30
    
Actually it doesn't even matter to me if the domains reject it - this is strictly for testing purposes, so I'm only sending to myself, and as long as I can see the postfix mail queue to know that it tried to send, I'm fine. –  EmmyS Feb 14 '11 at 0:08
    
@BillThor Of course you're not going to get the same level of trust but we're talking about a development box. If you need trust (the way you're talking about), you use a professional service that spends time (and money) certifying their mailservers' output as ham. My point is dovecot, dns, etc are all time/resource wastes. All you need is a default configuration of postfix. –  Oli Feb 14 '11 at 0:12
show 1 more comment

Well, GUI or CL interface for a mail server is not as important question, since you don't need UI for a mail server anyway, only at for initial configuration (ok, and maybe at times when there are configuration changes like relayhost, etc, but it's quite rare situation with an already-working server). So I don't think it's an important aspect. I can suggest using of postfix, it's enough to just install (apt-get install postfix) and the most basic configuration settings are asked on install time. Then it will work with PHP's mail(), etc, no need for further configuration or heavy/daily usage of any UI (let is GUI or CLI, though I don't know about GUI for postfix configuration, maybe some general system config solution like webmin will work for this purpose anyway). Just be careful, not to produce an open relay system :)

share|improve this answer
    
"Just be careful, not to produce an open relay system" - that's exactly why I was asking for something simple with a GUI interface. I'm a developer, not a mail admin, and I need to be able to set this up easily and safely, for the singular purpose of being able to test email-sending php code. –  EmmyS Feb 11 '11 at 15:30
    
I see your point. However if you only want a mail server for the underlaying infrastructure PHP mail() function to be able to send mails, it's a quite simple case, you can forget 99% of the mail server admin's issues. Especially if you have a fixed mail server you want to send your mails through (called "relay" or "smarthost") it's a very simple thing, and even the few questions asked at package install time are enough as "configuration". There can be issues, like someone cracks a web page and use it as spamming source, but it's not mail server related, more PHP/web hosting sechole ... –  LGB Feb 11 '11 at 15:40
    
I'll give it a shot. Right now this is 100% localhost. –  EmmyS Feb 11 '11 at 15:43
    
Also it's a mistake to treat GUI as for easier configuration in case of a server solution: many friends of mine treated that Windows things are easier since you don't need to know "CLI and other complicated things" and you're already a server admin. However the problem that even on GUI you won't know what deep-smtp-related things means, there GUI won't give you more than CLI. But it's out of scope of the question since your need is not a fully-featured mail server, only a tiny one which is used to submit mails from PHP. If I understood you well. –  LGB Feb 11 '11 at 15:44
    
Anyway I still think it's ok to install postfix package only, you need to reply for some easy questions. If you want to change, you can issue "sudo dpkg-reconfigure postfix" to ask those parameters again. postfix.org/postconf.5.html As you can see postfix has huge amount of configuration parameters, and GUI won't help on this too much. But for your purpose, I think it's OK to have only settings package configuration will ask, and it's OK then :) :) –  LGB Feb 11 '11 at 18:33
add comment

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.