2024-07-11 Exim config for UUCP, NNCP and MSMTP

My laptop doesn't have a static IP number. My mail service provider is not a smart host for my laptop. That's why I've been using msmtp to send email from the command line.

My ~/.mailrc used to contain the following:

set sendmail="/usr/bin/msmtp"

I removed this line because I want to send mails by UUCP or NNCP, depending on the domain used. It is only when none of these work that I want to fall back to msmtp.

Clearly, I need to add something to my exim configuration. When reading the exim config, it's important to understand that all the additions come in pairs: a router and a transport.

I use Debian.

mail and ed

I use mail to read mail and ed to write mail. At least when I'm doing this particular admin hobby project. 😂

As people will use a variety of domain names to send mail to me, I have to decide which ones mail should recognize as being "me". That's why ~/.mailrc contains the following:

alternates alex@sibirocobombus,alex@campaignwiki.org,alex@campaignwiki

To read MIME-encoded mail, I use munpack -t which comes with the mpack package.

/etc/exim4/update-exim4.conf.conf

This is the file generated by sudo dpkg-reconfigure exim4-config.

Importantly, it specifies that my laptop only delivers local mail. UUCP, NNCP and msmtp are all exceptions to that.

This config file also specifies that the exim configuration is split into many small files. This makes it easy for me to add new files.

When I make changes, I must always run sudo update-exim4.conf.

The config files are concatenated in sort order, which is why the file names start with numbers. All of the routers must sort before 200_exim4-config_primary because it stops all processing. It does that because this config file says that my laptop only delivers local mail.

dc_eximconfig_configtype='local'
dc_other_hostnames='melanobombus'
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost='alexschroeder.ch'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname='false'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

/etc/exim4/conf.d/router/110_exim4-config_uucp

The domains that get mail via UUCP are listed in /etc/exim4/uucp.

uucp_router:
    debug_print = "R: uucp_router for $local_part@$domain"
    driver = accept
    require_files = +/usr/bin/uux
    domains = wildlsearch;/etc/exim4/uucp
    transport = rsmtp

Example /etc/exim4/uucp:

dwalin	sibirocobombus!dwalin
campaignwiki	sibirocobombus

That is, dwalin can only be reached via sibirocobombus and campaignwiki is the same as sibirocobombus.

Note that mail to the `sibirocobombus` domain itself doesn't get sent via UUCP!

## /etc/exim4/conf.d/router/111_exim4-config_nncp

The domains that get mail via NNCP are listed in `/etc/exim4/nncp`.

nncp_router:

debug_print = "R: nncp_router for $local_part@$domain"

driver=accept

require_files = +/usr/bin/nncp-exec

domains = wildlsearch;/etc/exim4/nncp

transport = nncp

Example `/etc/exim4/nncp`:

sibirocobombus sibirocobombus

erebor erebor

Compare this to the previous entry. Mail to the `sibirocobombus` domain is sent via NNCP!

Both `sibirocobombus` and `erebor` must be defined in `/etc/nncp.hjson`.

## /etc/exim4/conf.d/router/112_exim4-config_msmtp

This relies on the fact that the sender is a local user.

msmtp_router:

debug_print = "R: msmtp_router for $local_part@$domain"

driver=accept

user = ${lookup{$sender_address_local_part}lsearch,ret=key{/etc/passwd}}

domains = ! +local_domains

require_files = +/usr/bin/msmtp

transport = msmtp

## /etc/exim4/conf.d/transport/40_exim4-config_uucp

rsmtp:

debug_print = "T: rsmtp for $pipe_addresses"

driver=pipe

command = /usr/bin/uux - -r -a${lookup{$sender_address_local_part}lsearch,ret=key{/etc/passwd}} -gC $domain_data!rsmtp

use_bsmtp

return_fail_output

user=uucp

batch_max = 100

## /etc/exim4/conf.d/transport/41_exim4-config_nncp

nncp:

debug_print = "T: nncp for $pipe_addresses"

driver=pipe

user=nncp

command = /usr/bin/nncp-exec -noprogress -quiet $domain_data rsmtp

use_bsmtp

return_fail_output

## /etc/exim4/conf.d/transport/42_exim4-config_msmtp

msmtp:

debug_print = "T: msmtp for $pipe_addresses"

driver = pipe

command = /usr/bin/msmtp --read-recipients --file=/home/${lookup{$sender_address_local_part}lsearch,ret=key{/etc/passwd}}/.config/msmtp/config

return_fail_output

Proxy Information
Original URL
gemini://alexschroeder.ch/2024-07-11-exim
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
162.499583 milliseconds
Gemini-to-HTML Time
0.992143 milliseconds

This content has been proxied by September (ba2dc).