Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:debian:configure-send-only-mailserver [2023/07/30 12:09] – removed - external edit (Unknown date) 127.0.0.1linux:debian:configure-send-only-mailserver [2024/11/18 22:02] (current) – [Postfix configuration] BIT
Line 1: Line 1:
 +====== Configure send-only mailserver for Systemmails ======
  
 +This guide shows how to install a send-only mailserver using ''postfix'' on Debian to automatically send emails e.g. of unattended-upgrades or cron-jobs.
 +
 +===== Postfix configuration =====
 +
 +**1.** Install ''postfix'' and ''mailutils'': 
 +<code bash>apt install postfix mailutils</code>
 +
 +**2.** Configure postfix as ''Internet site'': 
 +
 +{{:linux:debian:postfix_config_internet_site.png?400|}}
 +
 +Then enter the systemmail-name e.g. ''test.server.com'':
 +
 +{{:linux:debian:postfix_config_systemmail.png?400|}}
 +
 +**3.** Verify correct ''host''-file entry:
 +
 +<callout type="warning" icon="true">It is important that the first DNS name of the local server (''127.0.1.1'') contains the domain, otherwise some mail servers will reject the mails sent from this server because they can't verify the domain. So in our case the ''/etc/hosts'' file should look like this:</callout>
 +
 +
 +{{:linux:debian:postfix_config_host_file.png?400|}}
 +
 +If ''test'' would stand before ''test.server.com'' the system mails could be rejected.
 +
 +**4.** Test the configuration:
 +<code bash>sudo echo "Postfix Send-Only Server" | sudo mail -s "Postfix Testing" <address-where-the-mail-should-be-send-to></code>
 +
 +===== Set receiver address =====
 +
 +The receiver addresses of the system mails are configured in ''/etc/aliases'', the content //can// look like this:
 +<code bash>
 +# See man 5 aliases for format
 +root:           <target-mail-address>
 +
 +postmaster:     root
 +nobody:         root
 +hostmaster:     root
 +webmaster:      root
 +www:            root
 +</code>
 +
 +After changing ''/etc/aliases'', run the following command to update the aliases database:
 +<code bash>newaliases</code>
 +
 +===== Configure crontab emails =====
 +
 +If the receiver address is properly configured through the ''/etc/aliases'' file, just add ''MAILTO=root'' to the top of each crontab file that should send emails.