The MTA is a program that sends mail from one server to another. This is done through the SMTP protocol. On Debian the default MTA is Exim, however there are several GNU/Linux servers that contain this functionality like: sendmail, postfix and qmail.
I like postfix so let's start with that one.
Next to it's MTA functionality we also use it's MDA functionality by using the Maildir format for mail storage. Keep in mind that all mail for a user, when using Maildir, is stored in his/her home directory. This will grow the size of peoples home directory.
apt-get install postfix
Choose Satellite system when asked for configuration and supply what is needed.
The postfix configuration files can be found in /etc/postfix/.
The most important file is main.cf. Elements in this file that need special attention:
myhostname = smtp.domain.com mydestination = $myhostname, localhost.$mydomain, $mydomain mynetworks = 192.168.1.0/24, 127.0.0.0/8 relay_domains = $mydomain home_mailbox = Maildir/
Test the configuration with telnet:
telnet localhost 25 # from the local machine telnet smtp.domain.nl 25 # from a Internet machine telnet 192.168.1.1 25 # from an internal machine
Use the following procedure:
helo domain2.org mail from: user@domain2.org rcpt to: user@domain.com data . quit