translated by Google

Machine-translated page for increased accessibility for English questioners.

Configure the local mail system

Without mail forwarding, root mails are delivered to (or generally mails for users login arrives at ). To redirect you need to create an alias and properly configure a mail system that supports aliases (such as Postfix, Exim).

Mail system configuration

When configuring the Postfix mail system, you need to edit the file

# vi /etc/postfix/

and add a line

relayhost = []

and then run the command

# postfix reload

Root mail forwarding

Aliases are stored in a file /etc/aliases (resp. /etc/mail/aliases ). The location of the file depends on the mail system you are using. To create / edit aliases, you must be logged in as root .

# vi /etc/aliases
For mail forwarding to users root add a line

You must run a command after each change in the file

# newaliases

The command updates the alias database. For more information on aliases, see man 5 aliases .

Hostname Settings

Make sure you have the correct hostname, including domain:

$ hostname

On systems with systemd you can set the hostname with the command hostnamectl :

# hostnamectl set-hostname

Redirecting mail generated by the command sudo

To redirect mail to shape *** SECURITY information for *** to a different address than the default, add a command visudo to a new file /etc/sudoers.d/mailto line

Defaults mailto = adresa

But check that /etc/sudoers contains a row #includedir /etc/sudoers.d . Alternatively, you can edit directly /etc/sudoers .

Redirect cron mails

To redirect cron mails, you need to add a line to the file from which the tasks start up before the task definition

Problem solving

If you encounter problems during configuration, the logs of the mail system, usually located in the /var/log/mail* , /var/log/postfix or /var/log/exim*/ . To find the contents of the local mail queue, use the command mailq . If you encounter something you don't know, we'll advise you on .