Configure nullmailer with a relay host
If you wish to receive status updates from your Debian or Ubuntu system, you need to install and configure 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.
In this example, the hostname is debian, the local username bookworm and the Fastmail username [email protected].
Step 1
Because email deliverability depends on a multitude of factors, we use Fastmail as a relay host.
1) log into your Fastmail account and set up a new app password for SMTP authentication
2) set up a new Fastmail alias to receive incoming messages. In this example, we use [email protected]
Step 2
Create the new directory /etc/nullmailer and the file /etc/nullmailer/adminaddr.
$
sudo mkdir /etc/nullmailer && sudo nano /etc/nullmailer/adminaddrThe Fastmail alias is the only entry in /etc/nullmailer/adminaddr.
[email protected]Step 3
Install the required packages.
$
sudo apt-get install --yes nullmailer mailutilsStep 4
Set the system mail name. If you are setting up on a home network, you should use home.arpa as the domain name.
Configuring nullmailerMailname of your system:debian.home.arpaOk
Configuring the smarthost
Set the Fastmail server as the smarthost. Use the app password you set in Step 1.
Configuring nullmailerSmarthosts:
smtp.fastmail.com smtp --port=587 --auth-login --starttls [email protected] --pass=passwordOk
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" rootCheck your inbox!
Step 6
You can reconfigure nullmailer at any time by using the following comand.
$
sudo dpkg-reconfigure nullmailer#bookworm #debian #email #exim #fastmail #howto #internet #linux #postfix #sendmail #smtp #ubuntu