Backup Mailserver

Knowledge Base Entry: #123
^Top
<< Back
Mobile-Menu










Backup Mailserver
Category: Linux/Postfix
Author: Bugfish
Created at: 2021-02-16 19:22:39
Modified at: 2025-09-19 17:27:15
Directs Hits: 724

This is an easy postfix configuration to backup all emails going to specified domains until the master server is online again.

 

Postfix Configuration [replace yourhostname with your hostname]:

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
myhostname = yourhostname
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.yourhostname , localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
maximal_queue_lifetime = 30d

relay_recipient_maps =
relay_domains = hash:/etc/postfix/relaydomains
transport_maps = hash:/etc/postfix/transportmaps

/etc/postfix/transportmaps [how it could look like]

exampledomain.example       smtp:masterserver.exampledomain.example:587

 /etc/postfix/relaydomains [how it could look like]

exampledomain.example OK

 After you have changed the transportmaps or relaydomains file you have to run in console

postmap /etc/postfix/relaydomains
postmap /etc/postfix/transportmaps

Caution: I do not guarantee the reliability of the information given here, the code described on this page is executed at your own risk and in the event of damage or other unforeseeable consequences I am in no way responsible or liable.
This Website is using Session Cookies for Site Functionality.