This note presents a method of setting up ionos as a smart email relay for a registered domain (in this example, one called ionos.domain).
1. Set up Ionos and Get Details
You will need to have already set up your ionos mailbox, and bound it to one of your domain addresses.
You will also need to know the password to access your mailbox.
You can set these up in the Ionos Email configuration pages - just find your desired mailbox, and select Settings / Change Password etc. from the '...' drop-down menu.
2. Install Postfix
On the raspberry Pi, make sure that postfix is installed. You may also need to remove sendmail if it has been previously installed.
$ sudo apt-get remove sendmail
$ sudo apt-get install postfix
3. Edit /etc/postfix/main.cf
- Add a section for the ionos server (relayhost etc.)
- Add a link to the password details for ionos (sasl_passwd)
- Add a virtual aliases link for mail forwarding for local users
$ sudo vi /etc/postfix/main.cf
# Don't handle anything locally
# mydestination = ionos.domain, $myhostname, localhost.localdomain, localhost
# Setup Ionos relay
relayhost = smtp.ionos.co.uk:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
# Setup email forwarding
virtual_alias_maps = hash:/etc/postfix/virtual
4. Add your access details
$ sudo vi /etc/postfix/sasl_passwd
smtp.ionos.co.uk mailbox@ionos.domain:mailbox-password
$ sudo chmod 600 /etc/postfix/sasl-passwd
$ sudo postmap /etc/postfix/sasl-passwd
5. Create Mail Forwarding for Local Users
$ sudo vi /etc/postfix/virtual
asterisk forward1
admin forward1
root forward2
forward1 remoteuser1@gmail.com
forward2 remoteuser2@gmail.com
$ sudo chmod 644 /etc/postfix/sasl-passwd
$ sudo postmap /etc/postfix/sasl-passwd
6. Re-start postfix
$ sudo systemctl restart postfix
7. Check Postfix Logs
journalctl -u postfix@-.service