Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hello all i need to implement service that sends users reminders via email , this should be multithreaded scheduled system this part is fine , but i need to install and configure smtp server for out going emails on the server , this is i have no clue how to do and what to expect my tools will be lamp combo on some Linux(i guess ubuntu) slice .

share|improve this question

Installation is very distribution specific, because there are distribution recommended ways of installing software. It's very rare these days that I'd recommend anyone installing Postfix by source on any Linux distribution.

With ubuntu, use apt-get.

$ sudo apt-get install postfix

That will install postfix on your Ubuntu server, and the configuration thereafter is left to you. My advice is to pipe mails to the sendmail binary (usually at /usr/sbin/sendmail), which will hold mail in a queue if the Postfix system is down. If you use SMTP and connect to port 25, if your mail server ever needs to be down for some maintenance, your application will need to hold it's own queue of mail or risk mail not being delivered.

share|improve this answer

Install Postfix, following the directions on

share|improve this answer

You could also install exim4, which, while more complicated for difficult setups (due to debian's hackery) is far easier to setup to forward mail. just apt-get install exim4, and then, if necessary dpkg-reconfigure exim4-config.

share|improve this answer

Personally I would say think long and hard about where you see it going. If its just squirting out the odd mail on behalf of a webserver - go with Sendmail / Postfix. If it's going to be dealing with inbound email and users, and all the complication that that brings - I would consider exim4. The latter brings you a whole bunch of flexibility, database options by default, and virus / spam scanning before completing the SMTP transaction. Oh yeah - and its a pain to setup - but once sorted - sweet.

share|improve this answer

Postfix is not that hard to stand up from source code if you have ever built/compiled code from source before.

We use mailx to send emails outbound and mailx talks to a postfix SMTP server for the actual relay point.

Also, once you have a Postfix server up and running, other external servers can reference it for email relaying.

We use a scripted build process to build Postfix on our Linux distribution (Pozix Linux).

Here is the command we use to build Postfix make files:

make makefiles 'CCARGS=-DHAS_PGSQL -DUSE_TLS -I/usr/local/pgsql-8.2.13/include -DUSE_CYRUS_SASL -DUSE_SASL_AUTH -I/usr/include/sasl -I/usr/local/BerkeleyDB/include' 'AUXLIBS=-L/usr/local/lib -L/usr/local/pgsql-8.2.13/lib -L/usr/local/BerkeleyDB/lib -lpq -lsasl2 -lz -lm -lssl -lcrypto -lpthread'

You can adjust this to your needs. Since we use PostgreSQL, we have: -L/usr/local/pgsql-8.2.13/lib -lpq

You could eliminate these if you don't need PostgreSQL support; like wise for SASL and TLS.

After this command is executed,

make install (for new install) make upgrade (to upgrade a previous version)

For the mailx to work, we usually have a CRON job that calls a script as root.

The script, in turn, calls mailx.

MAILX uses a .rc file for reading environment variables and since we are calling mailx as the root user, we need to put a file called '.mailrc' in root's home directory.

The contents of .mailrc look as follows:

set set set set smtp-auth-password=alertspassword set smtp-auth=login

Then in our scripts we invoke mailx like so:

echo "Test Message" | mailx "" -s "Email Subject" "Email body"

or you could do this:

mailx -s "subject" -a /path/to/some/file

where -a allows you to attach a file and test.msg is an external file to read into the email body.

or another way, similar to first with file attachment, is to:

echo "Message Body" | mailx -s "subject" -a /path/to/some/file

share|improve this answer

Your Answer


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