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()?
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 contactingpostfix
.If you need to reconfigure, just run:
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 :
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.
If you only want to debug locally, you can follow this approach presented at stackoverflow. Single line in php.ini, no additional packages. Writes your outgoing mail to a file which can be opened with mail client in case you want to debug html mail.
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 :)
You do not need a mail server to send email, only to receive email. For sending email (using
sendmail
) select theInternet with smarthost
option.MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that's arrived so far.
https://mailcatcher.me/