If you want to receive status updates from your Debian or Ubuntu system, you need to employ the help of a mail tansfer agent (MTA). nullmailer is a relay-only forwarding MTA that can be used as an alternative to more complex MTAs such as Exim, Sendmail or Postfix.
nullmailer can be configured to use Fastmail as a smarthost and hence ensure the deliverability of your messages. In principle, these instructions should also be applicable to service providers other than Fastmail.
In the following example configuration, debian
is the hostname, bookworm
the local username and linus.torvalds@fastmail.com
the Fastmail username.
Step 1
Log into your Fastmail account and set up a new app password for SMTP authentication.
Step 2
Create the new directory /etc/nullmailer
and the file /etc/nullmailer/adminaddr
.
$ sudo mkdir /etc/nullmailer && sudo nano /etc/nullmailer/adminaddr
Your Fastmail username is the only entry in /etc/nullmailer/adminaddr.
linus.torvalds@fastmail.com
Step 3
Install the required packages.
$ sudo apt-get install --yes nullmailer mailutils
Step 4
Perform the initial configuration using debconf
. Reconfigure nullmailer
at any time after the initial installation using the following comand.
$ sudo dpkg-reconfigure nullmailer
Setting the mail name
Set the system mail name. If you are setting up on a home network, you should use home.arpa
as the domain name.
Configuring nullmailer Mailname of your system: debian.home.arpa Ok
Configuring the smarthost
Set the Fastmail server as the smarthost. Use the app password you set in Step 1.
Configuring nullmailer
Smarthosts:
smtp.fastmail.com smtp --port=587 --auth-login --starttls --user=linus.torvalds@fastmail.com --pass=password
Ok
Step 5
Test your configuration with the following command.
$ echo "Test mail from nullmailer on debian.home.arpa to the local root user and forwarded on to Fastmail" | mail -s "Test nullmailer" root
Check your Inbox, Linus!