This site is now 100% read-only, and retired.

Routing mail messages to your mailserver efficiently

Posted by Steve on Wed 10 May 2006 at 11:27

If you control satellite systems which need to relay their mail through a centralized host for sending then you have several choices. Perhaps the simplest software to use is the nullmailer program.

In the past we've looked at setting up exim, postfix, and sendmail forwarding but if you're not expecting to send much mail, and you don't need much processing then running a full mailserver is probably overkill.

The nullmailer package is very simple to configure and install. You can install it via:

root@itchy:~# apt-get install nullmailer
Reading package lists... Done
Building dependency tree... Done
Recommended packages:
  sysklogd system-log-daemon
The following packages will be REMOVED:
  exim4 exim4-base exim4-config exim4-daemon-light
The following NEW packages will be installed:
  nullmailer
0 upgraded, 1 newly installed, 4 to remove and 26 not upgraded.
Need to get 81.2kB of archives.
After unpacking 3019kB disk space will be freed.
Do you want to continue [Y/n]? 

As you can see installing a the nullmailer will remove the current mailserver you have installed, whether that is exim4 (the default mailer for Debian), postfix, or sendmail. Notice that the packages will only be removed and not purged. This means that your old configuration files will remain.

Once nullmailer is installed you will be prompted to configure it. There are only two things to do:

  • Specify your hostname, which will be used as the sender domain.
  • Specify your "smarthost" - which is the machine mail(s) should be forwarded to.

These can be adjusted later by editing the files /etc/mailname and /etc/nullmailer/remotes respectively.

Once configured and started you can proceed to remove the old configuration settings if you're happy:

root@itchy:~# dpkg --purge exim4 exim4-base exim4-config exim4-daemon-light
dpkg - warning: ignoring request to remove exim4 which isn't installed.
(Reading database ... 73209 files and directories currently installed.)
Removing exim4-base ...
Purging configuration files for exim4-base ...
Removing exim4-config ...
Purging configuration files for exim4-config ...
No override present.
dpkg - warning: ignoring request to remove exim4-daemon-light which isn't installed.

Messages which are delivered will be logged to syslog, (being visible in /var/log/mail.* by default), and you can see any queued but undelivered mails via the mailq program as you would expect.

 

 


Re: Routing mail messages to your mailserver efficiently
Posted by shufla (83.16.xx.xx) on Wed 10 May 2006 at 12:06
Hello,

You might be also interested in ssmtp.

Luke

[ Parent ]

Re: Routing mail messages to your mailserver efficiently
Posted by lee (193.82.xx.xx) on Wed 10 May 2006 at 12:50
[ View Weblogs ]

Note that the version of nullmailer distributed in Debian stable doesn't support SMTP AUTH, although the version in testing/unstable should.

Also, it doesn't support STARTTLS, which might make it unsuitable for trans-internet delivery. Some alternatives are listed on http://wiki.mutt.org/?LightSMTPagents.

[ Parent ]

Re: Routing mail messages to your mailserver efficiently
Posted by El_Cubano (66.93.xx.xx) on Tue 16 May 2006 at 17:50
Lack of support for SMTP AUTH and STARTTLS is what kept me from using nullmailer. Thankfully, postfix does support both of those and when you install it, debconf asks you if you want to setup a satellite system as one of the choices. The only hitch I ran into was that without sasl2-modules installed, my laptop would not relay properly since either PLAIN or STARTTLS would not work (I forget which).

Once I added that package, everything worked.

--
Roberto C. Sanchez
http://familiasanchez.net/~roberto

[ Parent ]

Re: Routing mail messages to your mailserver efficiently
Posted by Anonymous (82.130.xx.xx) on Thu 11 May 2006 at 10:31
You should also check esmtp: http://packages.debian.org/stable/mail/esmtp
it support also authentification. This is usefull to "forward" local home mail (dynamic IP) to an external MTA (not my ISP).

[ Parent ]

Re: Routing mail messages to your mailserver efficiently
Posted by Anonymous (134.96.xx.xx) on Sat 13 May 2006 at 22:11
What about local mail then?

[ Parent ]

Re: Routing mail messages to your mailserver efficiently
Posted by Steve (82.41.xx.xx) on Sat 13 May 2006 at 23:51
[ View Weblogs ]

If you want local mail then you're not an appropriate user for nullmailer - it is designed for setups where you have a lot of machines all relaying mail centrally; for example a hosting company.

Steve

[ Parent ]

Re: Routing mail messages to your mailserver efficiently
Posted by orchid (209.217.xx.xx) on Tue 23 May 2006 at 23:05
[ View Weblogs ]
What has to be done (if anything) to the server that is still running exim4?
lets say I have one box running sarge where all my email will be handled.
on my desktops I can then install nullmailer and follow your guide and it will send my mails to the server I specify. The problem was when I upgraded from woody on my server, exim (3 I think) was installed, with one relaively simple config file. Upgrading brought exim4 And foolishly perhaps I allowed it to split my configuration into what appears now to be lots of files :-)

So I would love to be able to send (and of course recieve) email from any host on my lan with only my server doing the actual talking to my isp. So it looks like nullmailer is for me but I am would need to find out what needs to be done on the server side.

[ Parent ]

Posted by orchid (209.217.xx.xx) on Tue 23 May 2006 at 23:09
[ View Weblogs ]
oh I missed this link at the beginning of your article... http://www.debian-administration.org/articles/63 perhaps thats what I need :-)

[ Parent ]

Re: Routing mail messages to your mailserver efficiently
Posted by Anonymous (89.206.xx.xx) on Tue 31 Dec 2013 at 10:25

I have found one incredibly good reason not to use nullmailer, at least in its default configuration: it does not correctly handle permanent rejections from the relay host. It should give up, but instead it retries indefinitely every few minutes. This means e.g. that if your relay host has a size limit and rejects your outsize message, you will try to send it again and again and can easily get cut off or incur large charges for excess bandwidth.

This is a known bug: it's 329192 - and the scenario peter green describes in comment #29 on that bug happened to me too, but on the public internet

[ Parent ]