translated by Google

Machine-translated page for increased accessibility for English questioners.

Local mail system configuration

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

Mail system configuration

When configuring the Postfix mail system, you must edit the file

# vi /etc/postfix/

and add a row

relayhost = []

and then run the command

# postfix reload

Mail redirection for root

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. You must be logged in as to create / edit aliases root .

# vi /etc/aliases
To redirect mail to users root add a line

You must run the command after each change in the file

# newaliases

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

Hostname setting

Make sure you have the correct hostname set, including the domain:

$ hostname

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

# hostnamectl set-hostname

Redirection of emails generated by the command sudo

For forwarding shape emails *** SECURITY information for *** to an address other than the default setting, add it with the command visudo to a new file /etc/sudoers.d/mailto line

Defaults mailto = adresa

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

Redirecting emails from cron

To redirect emails from cron, you must add a line to the file from which tasks are run before the task definitions

Problem solving

If you encounter problems with the configuration, you may find the mail system logs, usually located in /var/log/mail* , /var/log/postfix or /var/log/exim*/ . Use the command to find out the contents of the local mail queue mailq . If you come across something you can't handle, we'll advise you at .