9.6.1 Mail transport agents (MTAs)
For a full-featured MTA, use exim
in Woody and use
exim4
in Sarge. [
44] References:
The only reasonable alternative MTA is postfix
if you care about
security. sendmail
and qmail
are available as Debian
packages but are not recommended.
If you do not need the relay capability of an MTA as in the case of a satellite
system such as a laptop PC, you may consider using one of these lightweight
packages:
-
ssmtp
: needs an SMTP connection and is alias-capable, or
-
nullmailer
: can spool but is not alias-capable.
At this moment, I find exim
to be more suitable even for my
personal workstation machine, which is a laptop PC.
You may need to remove exim
for the installation of these
conflicting packages:
# dpkg -P --force-depends exim
# apt-get install nullmailer # or ssmtp
9.6.1.1 Smarthost
If you are running exim4
or exim
on a host which is
connected through the consumer grade services, please make sure to send
outgoing mail through a smarthost offered by your ISP or some others. [45] There are few good reasons:
-
to ensure SMTP retries since your ISP's smarthost usually have more reliably
connection.
-
to avoid sending mail directly from a dynamic IP address which
will likely be blocked by dial-up spam lists.
-
to save your local bandwidth to send mails with multiple recipients.
The only conceivable exceptions are:
-
the emergency cure for your ISP's SMTP service trouble.
-
an experiment for the educational purpose.
-
your host being a professionally hosted server.
9.6.1.2 Basic configuration of Exim
In order to use exim4
or exim
as your MTA, configure
the following:
/etc/exim/exim.conf "eximconfig" to create and edit (exim)
/etc/exim4/* "dpkg-reconfigure exim4-config" to create and edit (exim4)
/etc/inetd.conf comment out smtp to run exim as daemon
/etc/email-addresses Add spoofed source address lists
check filters using exim4
or exim
with -brw,
-bf, -bF, -bV, ... etc.
9.6.1.3 Setting up a catchall for nonexistent email addresses under Exim
In /etc/exim/exim.conf
(Woody or later), in the DIRECTORS part, at
the end (after the localuser: director) add a catch-all director that matches
all addresses that the previous directors couldn't resolve (per Miquel van
Smoorenburg):
catchall:
driver = smartuser
new_address = [email protected]
If one wants to have more a detailed recipe for each virtual domain, etc., add
the following at the end of /etc/exim/exim.conf
(per me, not well
tested):
*@yourdomain.com ${lookup{$1}lsearch*{/etc/email-addresses} \
{$value}fail} T
Then have an "*" entry in /etc/email-addresses
.
9.6.1.4 Configuring selective address rewriting for outgoing mail under Exim
Selective address rewrite for outgoing mail to produce proper "From:"
headers can be done using exim
by configuring near the end of
/etc/exim/exim.conf
:
*@host1.something.dyndns.org \
"${if eq {${lookup{$1}lsearch{/etc/passwd}{1}{0}}} {1} \
{$0}{[email protected]}}" frFs
This rewrites all addresses matching *@host1.something.dyndns.org.
-
It searches through /etc/password
to see if the local part ($1) is
a local user or not.
-
If it is a local user, it rewrites the address to the same thing it was in the
first place ($0).
-
If it is not a local user, it rewrites the domain part.
9.6.1.5 Configuring SMTP authentication under Exim
Some SMTP services such as yahoo.com require SMTP auth. Configure
/etc/exim/exim.conf
as follows:
remote_smtp:
driver = smtp
authenticate_hosts = smtp.mail.yahoo.com
...
smarthost:
driver = domainlist
transport = remote_smtp
route_list = "* smtp.mail.yahoo.com bydns_a"
...
plain:
driver = plaintext
public_name = PLAIN
client_send = "^cmatheson3^this_is_my_password"
Do not forget double quotes in the last line.