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

You must edit the file when configuring the Postfix mail system

# vi /etc/postfix/

and add a row

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

# vi /etc/aliases
For redirecting mail to users root add a row

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 mail generated by the command sudo

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

Defaults mailto = adresa

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

Redirecting mails from cron

To redirect e-mails from cron, a line must be added to the file from which the tasks are run before the task definitions

Problem solving

If you encounter problems during configuration, you may find the mail system logs, usually located at /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 .