Local mail system configuration
Without mail forwarding, root mails are delivered to
(or mails in general to users
root-jUi4UaON@fiYorGpuXWS.muniEB0BLg1Qv.cz
login
arrives at
login@fi.muni.cz
). 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/main.cf
and add a row
relayhost = [relay.fi.muni.cz]
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
root: login@fi.muni.cz
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
vasstroj.fi.muni.cz
On systems
systemd
you can set the hostname with the command
hostnamectl
:
# hostnamectl set-hostname vasstroj.fi.muni.cz
Redirection of emails generated by the command
sudo
For forwarding shape emails
*** SECURITY information for XY.fi.muni.cz ***
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
MAILTO=login@fi.muni.cz
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
unix=Mwra_rrq@fiqN2HL81gU.munirtzOdrCJX.cz
.